How to determine start and end points of fitting curve?

8 vues (au cours des 30 derniers jours)
Fotis
Fotis le 1 Déc 2015
Modifié(e) : dpb le 1 Déc 2015
Hi all, I have
x=[0.25 0.50 0.75 1]
y=[0.0001 0.1 0.6889 10]
and I use power(2) to get the fitting curve. Is there a way to determine some points in the fitting curve? Because, when I get my fitting curve equation and use the above data, I get for x=0.25,y = 0.048 which is quite far from 0.00001. Any idea anyone how can I fix this?

Réponses (1)

dpb
dpb le 1 Déc 2015
Modifié(e) : dpb le 1 Déc 2015
A power model doesn't fit these data worth a hooey at the lower end...try
plot(f,x,y,'*')
set(gca,'yscale','log')
ylim([y(1)/2 y(end)*2])
to see the problem; the curvature is positive for the fitted curve but negative in that region for the actual data. It appears either a 'power1' or linear in both log(x) log(y) would be a better fit of these data than 'power2'.
Addendum
b=polyfit(log(x),log(y),1); % fit log-log
yh=exp(polyval(b,log([x(1) x(end)]))); % Evaluate at end points
hold on
plot([x(1) x(end)],yh,'c') % add to the previous plot
You'll see this is quite a lot closer...but looking at residual errors one finds that the power1 model may be best overall...will leave that as "exercise for the student" :)
  1 commentaire
dpb
dpb le 1 Déc 2015
Oh, which illustrate why one should never curvefit w/o first plotting the data to see what gives...

Connectez-vous pour commenter.

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by