filtering - Adding signals and separate them using MATLAB -
i have 2 signals m(t) = exp(-100*abs(t))
, c(t) = cos(2*pi*1000*t)
. need add them , separate them using low pass filter (lpf) , band pass filter (bpf) , plot figures.
i wrote code :
fs = 100*1000; ts = 1/fs; t = -0.1:ts:0.1-ts; no = length(t); m = exp(-100*abs(t)); c = cos(2*pi*1000*t); g = m + c; y = abs(g); cutoff = 200; [a b]= butter(5,2*cutoff*ts); z = filter(a,b,y); figure(1) plot(t,m,t,z); legend('input signal','output signal') xlabel('time') ylabel('amplitude') title('case study')
note used lpf [a b] = butter(5,2*cutoff*ts);
the problem plot shifted , think because of dc component. can me edit code , fix shift? , should use bpf? if yes, how?
the offset getting using abs value of g
. if instead of filtering y
filter g
better result. offset comes dc component of abs(c)
since not centered on zero, , low pass filter maintain offset
Comments
Post a Comment