How to apply Polyfit to a cell array

3 ビュー (過去 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 Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by