fit the y=mx+c in time series

조회 수: 2 (최근 30일)
Nurul Ain Basirah Zakaria
Nurul Ain Basirah Zakaria 2021년 3월 28일
댓글: Star Strider 2021년 3월 28일
Hi. I have 420x1 data of time series.
How can I fit y=mx+c line in the plotting?

답변 (1개)

Star Strider
Star Strider 2021년 3월 28일
That could be a challenge.
One option is to use mldivide,\:
dt = datetime('now')+days(1:10);
T1 = table(dt(:), rand(10,1)+(0.1:0.1:1).');
B = [day(T1.Var1) ones(size(T1.Var1))] \ T1.Var2;
LinFit = [day(T1.Var1) ones(size(T1.Var1))] * B;
figure
plot(T1.Var1, T1.Var2, 'p')
hold on
plot(T1.Var1, LinFit, '-r')
hold off
grid
Depending on the time series, the results could appear a bit unusual.
.
  댓글 수: 4
Nurul Ain Basirah Zakaria
Nurul Ain Basirah Zakaria 2021년 3월 28일
ya im sorry. its not the threshold ;) thank you very much!
Star Strider
Star Strider 2021년 3월 28일
My pleasure!
Did I provide a meaningful solution?
If not, what do you want to do?

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

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by