フィルターのクリア

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

106 ビュー (過去 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 件のコメント
rohith bharadwaj
rohith bharadwaj 2017 年 9 月 5 日
Thank you so much. THe code is working and I'm getting the output. Thank you :-)
Star Strider
Star Strider 2017 年 9 月 5 日
My pleasure.
Since my Answer solved your problem, please Accept it!

サインインしてコメントする。


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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with Signal Processing Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by