How to curve fitting for array?

4 views (last 30 days)
Ege Tunç
Ege Tunç on 16 Mar 2019
Edited: Ege Tunç on 16 Mar 2019
I have 2 arrays, i've plotted them, now i needed to curve fitting for them. I've checked this page: https://www.mathworks.com/help/curvefit/fit.html
But it wasn't helpful for me.
Here is my code:
U=[10 9.7 9.4 9.1 8.8 8.5 8.2 7.9 7.6 7.3 7.0 6.7 6.4 6.1 5.8 5.5 5.2 4.9 4.6 4.3 4.0];
y1=[0.7 0.75 .8 .85 .9 1.05 1.05 1.1 1.1 1.1 1.15 1.15 1.10 1.1 1.1 1.1 1.1 1.15 1.10 1.15 1.2;0.75 0.75 0.85 0.95 1 1 1.05 1.1 1.1 1.1 1.1 1.15 1.2 1.2 1.25 1.25 1.25 1.3 1.3 1.3 1.35;.7 .75 0.75 0.8 0.85 0.85 0.9 0.95 1 1 1 1 1.05 1.05 1.05 1.1 1.1 1.15 1.15 1.15 1.2];
y2=[1.2 1.3 1.35 1.4 1.4 1.45 1.5 1.55 1.55 1.6 1.6 1.67 1.67 1.75 1.75 1.8 1.9 1.9 2 2.05 2.1; 1.25 1.3 1.4 1.4 1.45 1.45 1.5 1.55 1.6 1.65 1.65 1.7 1.7 1.75 1.85 1.9 1.9 1.95 2 2.05 2.1;1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.5 1.55 1.6 1.6 1.65 1.7 1.7 1.75 1.8 1.85 1.9 1.95 2 2.05];
M1=mean(y1);
M2=mean(y2);
h=6.625.*10.^(-34);
m=9.109.*10.^(-31);
e=1.602.*10.^(-19);
lambda=h./sqrt(2.*m.*e.*U.*1000);
hold on
ylim([0.7 2.1])
xlim([1.22e-11 2.0e-11])
plot(lambda,M1)
plot(lambda,M2)

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!