MATLAB Answers

I have a set of experimental data in form of a parameter as a function of the other, keeping certain conditions constant. How do I know the best curve that fits the data?

2 ビュー (過去 30 日間)
Adewale Olasumboye
Adewale Olasumboye 2021 年 9 月 14 日
回答済み: darova 2021 年 9 月 14 日
I'm new to MATLAB. I already used excel to check what fit is best for the data. Exponential and Polynomial seem to be better than linear fit. Is there a way I can use MATLAB to know which one is perfect for my data? Any code or tips?

回答 (1 件)

darova
darova 2021 年 9 月 14 日
Use fit
x = 0:0.1:2;
y = x.^2 + 0.2*rand(size(x));
f = fit(x(:),y(:),'poly2');
plot(x,y,'.r')
line(x,f(x))
legend('original data','fitted function')

Community Treasure Hunt

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

Start Hunting!

Translated by