MATLAB Answers

Fitting the data without using curve fitting tool

조회 수: 2(최근 30일)
shaina dhamija
shaina dhamija 21 Nov 2019
Answered: KSSV 21 Nov 2019
Hi. I have a matrix and I have been using the following syntax to fit some data from the matrix z.
[~,~,output] = fit(t,z(:,32),'poly3');
p= output.residuals
The output residuals get stored as output.residuals in the workspace and have to be extracted.
I wish to do the fitting for all the columns in the matrix and use the residuals for all columns in a loop. I wish to put the fitting syntax directly in the loop and not extract output residuals since the loop doesn't run.

  댓글 수: 0

로그인 to comment.

답변 수 (1)

KSSV
KSSV 21 Nov 2019
YOu can use polyfit.
p = polyfit(t,z(:,32),3) ;
zi = polyval(p,t) ;

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by