Curve Fitting - X &Y data

4 views (last 30 days)
Abraham
Abraham on 16 Nov 2018
Commented: Abraham on 17 Nov 2018
I have x and y. Image attached
How can I do at least three different curve fits that are appropriate for the data?
data no noise.PNG
  1 Comment
dpb
dpb on 16 Nov 2018
Start by plotting...sounds like homework???

Sign in to comment.

Accepted Answer

KSSV
KSSV on 17 Nov 2018
Take this as a demo example. In T and mu, you have to enter your data. Read about plot and polyfit.
T = linspace(0,4*pi,10);
mu = sin(T);
% Use polyfit to fit polynomial to the points.
T1 = linspace(min(T),max(T));
figure
hold on
plot(T,mu)
for n = 1:3
p = polyfit(T,mu,n);
% Evaluate the polynomial on a finer grid and plot the results.
mu1 = polyval(p,T1);
plot(T1,mu1)
end
legend({'Original','n = 1 fit','n = 3 fit','n = 3 fit',})

More Answers (0)

Categories

Find more on Linear and Nonlinear Regression in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!