フィルターのクリア

Getting x value for a given y value from a fitted model

2 ビュー (過去 30 日間)
Wei Han
Wei Han 2019 年 3 月 9 日
コメント済み: Star Strider 2019 年 3 月 9 日
Here is my codes:
c=3*10^8; % speed of light
h=6.62606957*10.^-34; % Planck constant
k=1.3806488*10.^-23; % Boltzmann constant
T=(400:1:1000); % Temperatures in Kelvin
Wavelength=(0.925:0.001:0.975).*1e-6; %Wavelength from 0.925 to 0.975um
for i=1:601
I1(i,:)=(2*h*c*c)./((Wavelength.^5).*((exp((h.*c)./(k.*T(i).*Wavelength))-1)));
z(i) = trapz(Wavelength, I1(i,:));
end
Then the T and z are used to get a fitted curve
QQ截图20190309164625.png
I know it is easy to get z with z=fever(fittedmodel,T)
Is there any easy way to get T value from z value?
I tried to use z as xData and T as yData, but the fitting results are terrible. And I know I can use vpasolve to calculate z, but the errors in results is large because the coefficients is a range.
So, what can I do?

採用された回答

Star Strider
Star Strider 2019 年 3 月 9 日
I am not certain that the curve fit is at all relevant to your finding a ‘T’ for a specific ‘z’.
Try this:
c=3*10^8; % speed of light
h=6.62606957*10.^-34; % Planck constant
k=1.3806488*10.^-23; % Boltzmann constant
T=(400:1:1000); % Temperatures in Kelvin
Wavelength=(0.925:0.001:0.975).*1e-6; %Wavelength from 0.925 to 0.975um
for i=1:601
I1(i,:)=(2*h*c*c)./((Wavelength.^5).*((exp((h.*c)./(k.*T(i).*Wavelength))-1)));
z(i) = trapz(Wavelength, I1(i,:));
end
zv = 2/3; % Desired ‘z’ Value
Tv = interp1(z, T, zv, 'linear'); % Associated ‘T’ Value
figure
plot(T, z)
hold on
plot(Tv, zv, '+r')
hold off
grid
xlabel('T')
ylabel('z')
Note that because ‘z’ is monotonically increasing with linearly increasing ‘T’, this approach is possible here. That is not allways the situation, so this approach would not be universally appropriate (for example if ‘z’ was periodic, parabolic, or something similar).
Experiment to get the result you want.
  2 件のコメント
Wei Han
Wei Han 2019 年 3 月 9 日
Thank you vey much!
Star Strider
Star Strider 2019 年 3 月 9 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by