フィルターのクリア

Error Using Function Fplot

3 ビュー (過去 30 日間)
Harel Harel Shattenstein
Harel Harel Shattenstein 2018 年 7 月 8 日
回答済み: Stephan 2018 年 7 月 8 日
T=[-20:20:120]
mu=[4 0.38 0.095 0.032 0.015 0.0078 0.0045 0.0032]
function []=ex4(T,mu)
A=[ones(length(T),1) T', (T.^2)'];
sol=A\(log(mu))';
f=@(x)e^(sol(1)+sol(2)*x+sol(3)*x.^2);
hold on
fplot(f,[min(T),max(T)])
scatter(T,mu)
end
I get and error in fplot, what can it be?

採用された回答

Stephan
Stephan 2018 年 7 月 8 日
Hi,
this should work - see comment for the issue:
T=[-20:20:120]
mu=[4 0.38 0.095 0.032 0.015 0.0078 0.0045 0.0032]
% Call the function to see the plot
ex4(T,mu)
function []=ex4(T,mu)
A=[ones(length(T),1) T', (T.^2)'];
sol=A\(log(mu))';
% ----------------------------------------
% --> if you want e^x in matlab use exp(x)
f=@(x)exp(sol(1)+sol(2).*x+sol(3).*x.^2);
% ----------------------------------------
hold on
fplot(f,[min(T),max(T)])
scatter(T,mu)
end
Best regards
Stephan

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by