Clear Filters
Clear Filters

Curve Fitting of Data Points

2 views (last 30 days)
Anas Rao
Anas Rao on 24 Dec 2016
Answered: Star Strider on 24 Dec 2016
I have lot of data points. I want to make an equation according to the curve formed. But the equations comes from the curve fitting, when I put again in the equation x-point it is not giving corresponding y-point. I am interested to make such equation in which when I put the x-point it would automatically gives the y-points?

Accepted Answer

Star Strider
Star Strider on 24 Dec 2016
This is not parameter estimation (‘curve fitting’) as such, but if you want a way to fit all the points exactly, using the interp1 function with the 'spline' method will work:
N = 50; % Number Of Points
x = 1:N;
y = rand(1, N);
xi = linspace(min(x), max(x), 250);
yi = interp1(x, y, xi, 'spline');
figure(1)
plot(x, y, 'gp')
hold on
plot(xi, yi, '-r')
hold off
grid

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!