highpass function vs "manual" filtering
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am using the highpass function to filter a signal (a temperature timeseries) and the result I get are resonable. I am trying to reproduce the results "maunually". Meaning I took the time sereis I did the FFT then I took the part of the frequency spectrum i am interested in and then I antitrasform the filtered spectrum. The results I get are very different (and not very reasonable from a physical point of view). So I am wondering:
what I am I doing wrong in implementing the manual fitering?
Does the highpass function follow the same steps?
Thanks in advance
Giacomo
I have attached the code and a file with the temperature time serie
Here is my code for manual filtering:
ship=readtable('shipdata_for_mat_ans');
ship=table2timetable(ship);
y = fillmissing(ship.ta,'movmean',height(ship)); % Signal (Vector Or Matrix)
t = posixtime(ship.Time); % Time Vector
Fs = 1/mean(diff(t)); % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
ym = y - mean(y); % Subtract Column Means From All Columns (Eliminates D-C Offset Effect)
L = numel(t); % Signal Lengths
FTy = fft(ym);%/L; % Fourier Transform (if you want it Scaled For Length uncomment the division by L)
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
sp=real(FTy(Iv,:));
sp_dc=sp(sp>=1/(24*3600));
dc=ifft(sp_dc,height(ship));
while using the highpass function i just do:
ship=readtable('shipdata_for_mat_ans');
ship=table2timetable(ship);
y = fillmissing(ship.ta,'movmean',height(ship)); % Signal (Vector Or Matrix)
dc = highpass(y,1/(24*3600),1/60,'Steepness',0.95);
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!