how to do a TRENDLINE (polyfit?how?)

 Respuesta aceptada

Matt Fig
Matt Fig el 28 de Nov. de 2012
Editada: Matt Fig el 28 de Nov. de 2012

0 votos

See the help for the POLYFIT function.
I see you edited the question to include (polyfit?how?) but what is the problem? Did you actually read the help for POLYFIT (that I even linked for you!) or do you want everyone else to do all the work for you?
If you have difficulty, why not show where you are stuck?

2 comentarios

joo
joo el 28 de Nov. de 2012
i am sorry, when i edited i have not seen your answer. my probl in polyfit isthat i don't get a R2 like excel.
even if i do it in excel and then try thsat results in matlab i don't get a good answer
can you help me?
Matt Fig
Matt Fig el 29 de Nov. de 2012
I downloaded your file and got the exact same results as Excel with MATLAB. I called the data N.
>> X = N(22:end,1);
>> Y = N(22:end,2);
>> [pp,s] = polyfit(X,Y,1)
pp =
-0.0406 0.8654
s =
R: [2x2 double]
df: 76
normr: 0.2742
>> r_squared = 1 - s.normr^2 / norm(Y-mean(Y))^2
r_squared =
0.9719

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 28 de Nov. de 2012

0 votos

There is a curve fitting toolbox if you want. It handles non-polynomial functions. Check it out.

3 comentarios

joo
joo el 28 de Nov. de 2012
thank i checked. but there is only a possibility, to plot 'linear'. nothing more is possible right=?
Image Analyst
Image Analyst el 28 de Nov. de 2012
Not sure what you looked at but I saw all kinds of curvy and wavy functions being fitted to data.
joo
joo el 28 de Nov. de 2012
yes, i know. but what i need is the black straight line http://i50.tinypic.com/nprtht.jpg that in excel is a trendline as you can see in the excel file< http://www.speedyshare.com/ABueW/aaa.xlsx>. if you npl,ease could helop i would be very grateful. thank you

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

joo
el 28 de Nov. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by