Regarding POLYFIT function in MATLAB

1 Ansicht (letzte 30 Tage)
Parth PAtel
Parth PAtel am 3 Okt. 2011
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...

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 3 Okt. 2011
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 Kommentar
Parth PAtel
Parth PAtel am 3 Okt. 2011
Thank you so much...Its working and I am trying to use in code..Thanks again

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by