How to apply Polyfit to a cell array
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File 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!