Trend lines

조회 수: 13 (최근 30일)
Chloe
Chloe 2012년 1월 31일
답변: Chad Greene 2015년 1월 22일
Hi, I am trying to plot linear trend lines for a number of data sets and determine their respective gradients. Is there any way of doing this without using the 'tools,basic fitting' tab in the figure? Doing this for every plot will be quite time consuming. Sorry, I know this is probably a pretty basic question, but I'm pretty new to Matlab and would really appreciate any help. Thanks Chloe x

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 1월 31일
Perhaps polyfit() and polyval()?
doc polyfit
doc polyval
  댓글 수: 1
Chloe
Chloe 2012년 1월 31일
Fab! Thank you :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Chad Greene
Chad Greene 2015년 1월 22일
...Or to streamline the polyfit -> polyval -> plot process, polyplot does it all in one step, just like this:
polyplot(x,y)
You can also include any line formatting commands, just as you would with plot. For example,
polyplot(x,y,'r--','linewidth',3)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by