i have a signal with many frequencies. how to remove a particular frequency and reconstruct the signal.
39 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (2)
Star Strider
el 3 de Sept. de 2017
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 comentarios
Star Strider
el 5 de Sept. de 2017
My pleasure.
Since my Answer solved your problem, please Accept it!
Image Analyst
el 3 de Sept. de 2017
Editada: Image Analyst
el 3 de Sept. de 2017
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).
Ver también
Categorías
Más información sobre Transforms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!