i have a signal with many frequencies. how to remove a particular frequency and reconstruct the signal.

39 次查看(过去 30 天)
I heard about doing fft and then ifft but don't know how to implement. for example, the frequencies are close to each other as ( 0.1282 0.5128 0.8974 1.1538) now, how can I remove only 0.5128 Hz frequency and reconstruct the signal.
I've attached my data file and frequency finding code.

回答(2 个)

Star Strider
Star Strider 2017-9-3
Try this filter:
signal = load('datee.txt'); % Signal Vector
signal = detrend(signal,0);
Fs = 10; % Sampling Frequency (Hz)
Ts = 1/Fs; % Sampling Interval (sec)
tv = linspace(0, 1, numel(signal))*Ts; % Time Vector
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = [0.503 0.523]/Fn; % Passband Frequency (Normalised)
Ws = [0.483 0.543]/Fn; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple (dB)
Rs = 50; % Stopband Ripple (dB)
[n,Ws] = cheb1ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby1(n,Rs,Ws,'stop'); % Filter Design
[sossb,gsb] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(5)
freqz(sossb, 2^16, Fs) % Filter Bode Plot
filtered_signal = filtfilt(sossb, gsb, signal); % Filter Signal
figure(6)
subplot(2,1,1)
plot(tv, signal)
grid
subplot(2,1,2)
plot(tv, filtered_signal)
grid
This designs a narrow Chebyshev Type I bandstop filter. Experiment with the filter stopbands and passbands to get the result you want.
To use it with my previous code, append it to the end of my previous code, and substitute this assignment:
signal = load('datee.txt'); % Signal Vector
with this one:
signal = filtered_signal;
  4 个评论

请先登录,再进行评论。


Image Analyst
Image Analyst 2017-9-3
编辑:Image Analyst 2017-9-3
Find the index for that frequency, and set it to 0, then call ifft().
See attached demo (though it's for a 2-D image, not a 1-D signal though the concept is the same).
  1 个评论
rohith bharadwaj
rohith bharadwaj 2017-9-4
thanks for the help. but can I get the code like, enter the frequency to remove: like scanf in C and then get the reconstructed signal by removing this frequency

请先登录,再进行评论。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by