How to apply Polyfit to a cell array

3 Ansichten (letzte 30 Tage)
siddharth rawat
siddharth rawat am 14 Apr. 2017
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')

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by