remove noise from signal
6 views (last 30 days)
Show older comments
Guys, im doing an assignment that design a lowpass butterworth filter to get filter order, draw magnitude, pole zero plot, impulse remove noise from noisy file. I have some difficulty
- I need to get magnitude start from 40db but i try to multiply k with 100 but nothing change
- After filtered, i get no signal
Please explain to me, thank you.
I attached my code and noisy file.
0 Comments
Accepted Answer
Star Strider
on 17 Dec 2022
Edited: Star Strider
on 17 Dec 2022
Change:
[b,a] = butter(n,Wn);
to:
[z,p,k] = butter(n,Wn);
and eliminate the tf2zp call.
Then the filtfilt call should be:
filtered_signal = filtfilt(sos,g, noisy);
See the documentation on the zplane function for details on how to use it. Use the ‘sos’ output as the argument for zplane and impz.
I have no idea what ‘I need to get magnitude start from 40db’ means. Note that ‘Rp’ (passband ripple or magnitude) and ‘Rs’ (stopband ripple or magnitude) are defined in terms of dB, so change them to do what you want.
Testing the signal —
LD = load(websave('bai2','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1234397/bai2.mat'))
noisy = LD.noisy;
Fs = LD.fs;
L = numel(noisy);
t = linspace(0, L-1, L)/Fs;
filtered_signal = lowpass(noisy, 2500, Fs, 'ImpulseResponse','iir');
figure
subplot(2,1,1)
plot(t, noisy)
grid
subplot(2,1,2)
plot(t, filtered_signal)
grid
ylim([-1 1]*0.015)
The filtered signal (here the output of an elliptic lowpass filter simply to be certain that there was something left after filtering it) has a very small amplitude, so plot it separately as I did here in order to see it. Your result should look something like this result.
EDIT — (17 Dec 2022 at 15:24)
Minor corrections.
.
2 Comments
More Answers (0)
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!