Regarding POLYFIT function in MATLAB

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Get 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