band pass filter current data and PSD

2 views (last 30 days)
reddy
reddy on 20 Feb 2014
Hello all
I am using MATLAB for Ocean Science research. I want to filter 20 day current data which is 117 days data (everyday one measurement). Now I want to see POWER spectrum after 20 days means (mask or filter below 20 day signals). For that I just used code which is suggested by some one who answers matalb questions. But, still it shows peaks with in 20 days where I dont want to see them with in 20 days. I want them to be flattened. Hope you all got m
y point. And I am attaching the sample data set as well as the code, output image.
Please check my code and let me know where did I went wrong.
u = xlsread('sample.xlsx');
d = fdesign.lowpass('N,Fp,Ap,Ast',20,1/20,1,20,1);
D = design(d);
y = filter(D,u);
N= length(u); % number of points
T = N;
t=(0:N-1)/N; % defining time
f = (0:N/2-1)/T;
per = 1./f; % finding the corresponding frequency and period in days
p_sur_cur= abs(fft(y))/(N/2); % absolute value of the FFT
pow_sur = p_sur_cur(1:(N)/2).^2; % take the power of positive freq half
plot(per,log(pow_sur),'color','m','LineWidth',2); legend('U-current','Location','southeast');grid on

Answers (0)

Community Treasure Hunt

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

Start Hunting!