how to perform a polyfit on semilog plot?

10 ビュー (過去 30 日間)
ali mohebi
ali mohebi 2018 年 11 月 12 日
コメント済み: Star Strider 2018 年 11 月 12 日
hi all. i have these two set of data, 'FOE' and 'Nc'. i want to plot FOE vs Nc in semilog plot (Nc placed on x axis increasingly and log scale, FOE on y axis, increasingly). how can i use polyfit command to pass a first order line from this semi-logarithmic graph and obtain slope and interceptof the fitted line. thanks in advance for all the advice you provide.

採用された回答

Star Strider
Star Strider 2018 年 11 月 12 日
Try this:
FOE=[0.000743 0.000747 0.000747 0.000746 0.000746 0.000744 0.000744 0.000743 0.00065 0.00065...
0.000648 0.000648 0.000646 0.000646 0.000644 0.000644 0.000252 0.000252 0.000251 0.000251 0.000251...
0.000251 0.00025 0.00025 0.000219 0.000219 0.000219 0.000219 0.000218 0.000218 0.000217 0.000217];
Nc=[3.76e-7 8.97e-8 5.09e-8 3.55e-8 2.73e-8 2.22e-8 1.87e-8 1.61e-8 1.42e-8 1.26e-8 1.14e-8 1.04e-8 9.6e-9...
8.8e-9 8.2e-9 7.7e-9 7.2e-9 6.8e-9 6.4e-9 6.1e-9 5.8e-9 5.5e-9 5.3e-9 5.1e-9 4.8e-9 4.7e-9 4.5e-9 4.3e-9...
4.2e-9 4e-9 3.9e-9 3.8e-9];
B = polyfit(log(Nc), FOE, 1);
fitFOE = polyval(B,log(Nc));
Slope = B(1);
Intercept = B(2);
figure
semilogx(Nc, FOE, '*', Nc, fitFOE,'-')
grid
  2 件のコメント
ali mohebi
ali mohebi 2018 年 11 月 12 日
thanks
Star Strider
Star Strider 2018 年 11 月 12 日
As always, my pleasure.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by