How to extend the fitting curve in command

6 Ansichten (letzte 30 Tage)
Thi Na Le
Thi Na Le am 10 Aug. 2014
Beantwortet: Sagar bendre am 12 Aug. 2016
I want to fit a set of data with custom function. I wrote:
"" Wavelength=VarName3
Wavelength =
1.0e+03 *
0.6176
0.6273
0.6371
0.6482
0.6572
0.6684
0.6801
0.6902
0.7014
0.7103
0.7218
0.7333
0.7431
0.7524
0.7608
0.7721
0.7825
0.7934
0.8044
0.8179
0.8267
0.8365
0.8469
0.8565
0.8658
0.8771
0.8907
0.9028
0.9110
0.9215
0.9316
0.9407
0.9503
0.9605
0.9707
0.9797
0.9945
1.0004
1.0115
>> Intensity=VarName4
Intensity =
795.5000
788.5000
773.5000
727.0000
716.5000
694.5000
656.5000
626.5000
600.0000
595.5000
593.0000
589.5000
545.0000
540.5000
516.5000
509.0000
475.5000
470.0000
432.5000
394.0000
369.0000
357.5000
355.5000
329.0000
315.5000
307.0000
302.5000
300.0000
293.0000
291.0000
279.0000
275.0000
269.0000
265.0000
242.0000
240.0000
234.5000
233.0000
224.0000
>> f = fit(Wavelength , Intensity, 'a*100000000000*(x.^-5)*(exp(1.4E07/(T*x))-1).^-1', 'StartPoint', [10000,0.0014] )
f =
General model:
f(x) = a*100000000000*(x.^-5)*(exp(1.4E07/(T*x))-1).^-1
Coefficients (with 95% confidence bounds):
T = 8917 (8406, 9428)
a = 8.682e+06 (7.45e+06, 9.913e+06)
>> plot( f,Wavelength,Intensity,'o' )
""
And I got the plot as follow
Now I want to extend the fitting curve further like this figure:
What should I do??? I need your help

Akzeptierte Antwort

Ahmet Cecen
Ahmet Cecen am 10 Aug. 2014
All you need to do is calculate Y axis for that entire range using the fit you calculated. Pass x=0:1:1400 through f(x), then plot x vs f(x).
  5 Kommentare
Ahmet Cecen
Ahmet Cecen am 10 Aug. 2014
Bearbeitet: Ahmet Cecen am 10 Aug. 2014
OOOH. Use the hold command to overlay the two figures. Say:
x=0:1:1400;
yhat=f(x);
plot(x,yhat); %As before
hold on;
plot(X,Y,'o');%Check http://www.mathworks.com/help/matlab/ref/linespec.html for marker types.
X and Y would be your actual training data, so I think X is wavelength and Y is intensity. Use the GUI afterwards to polish the figure.
Thi Na Le
Thi Na Le am 10 Aug. 2014
Thank you. I already got the point. I just wrote: plot (Wavelength,Intensity, 'ro', x, yhat,'r'); :))))))

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Amr Hashem
Amr Hashem am 26 Okt. 2015
try:
hold on
before the extended plotting

Sagar bendre
Sagar bendre am 12 Aug. 2016
HI, I am plotting a PSD with pwelch. I want to increase in max range of wavelength. Ufortunatelly the range by software is holding till 3.14 cyc/m. I want to see max wavelength of my data..
pl let me know...

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by