how to plot a curve fitting on a semilog
5 ビュー (過去 30 日間)
古いコメントを表示
im trying to plot a curve fitting on a semi log graph to get its slope this is what ive tried
pws=[1150 1794 1823 1850 1876 1890 1910];
t=[0 2 4 8 16 24 48];
tp=3*24;
for i=2:length(pws)
horn(i)=((t(i)+tp)/(t(i)))
end
semilogx(horn,pws,'O-')
m=polyfit(horn,pws,1)
m(1)
k=((162.6*q*b*u)/(m(1)*h))
set(gca,'YLim',[1780 1960])
hold on
mm=polyval(m,horn)
semilogx(horn,mm,'-r');
but when i try it all i get is that
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160482/image.png)
2 件のコメント
回答 (1 件)
Walter Roberson
2016 年 4 月 8 日
You are using horn as your base variable to fit against, but horn is not monotonic. If you
plot(horn,pws)
you can see that clearly.
semilogx(horn,pws) does not show how bad the graph is because horn(1) is 0 (because you did not assign any value to horn(1)), and log(0) is -infinity, so the first data point is not drawn on the semilogx plot.
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!