Regarding POLYFIT function in MATLAB

1 回表示 (過去 30 日間)
Parth PAtel
Parth PAtel 2011 年 10 月 3 日
k=1:1:100; a=log2(k);
p2 = polyfit(k,a,2);
{which create graph for all the values and make an 2nd order equation to represent that graph}
I get the answer like this...
p2 =
Columns 1 through 2
-0.000645220551355 0.106511608440816
Column 3
2.051917442148469
I want to access all three values separately...
Does anyone know any command or function or code for that....
for example Like
p2.1= -0.000645220551355
p2.2= 0.106511608440816
p2.3= 2.051917442148469
so in the next code if I want to use just 2nd value I can write x = p2.2*3 etc.
Thanks in advance...

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 10 月 3 日
try
p2(1)
p2(2)
p2(3)
The "Getting Started" portion of the MATLAB documentation will be helpful for you. http://www.mathworks.com/help/techdoc/learn_matlab/f2-8955.html
  1 件のコメント
Parth PAtel
Parth PAtel 2011 年 10 月 3 日
Thank you so much...Its working and I am trying to use in code..Thanks again

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by