How to apply Polyfit to a cell array

조회 수: 1 (최근 30일)
siddharth rawat
siddharth rawat 2017년 4월 14일
I have a Cell array of size 1x512 (spatiotemporal data), inside which each element of cell array holds a 2D matrix of size 127 X 65. now I want to apply a 6th order polyfit function to all pixel locations evolving in time. I have successfully applied it to a single pixel location evolving in time but not to the whole cell array. The code is as following:
for ii=1:512
DATA(ii)=mycell_opd{1,ii}(39,44);
end
DATA=DATA.*10^9;
t = (1:length(DATA));
opol = 6;
[p,s,mu] = polyfit(t,DATA,opol);
f_y = polyval(p,t,[],mu);
dt_ecgnl = DATA - f_y;
figure(1); plot(DATA); title('data showing trends')
figure(2); plot(dt_ecgnl); title('data after removing trends')

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by