Help with LPF and signal
4 views (last 30 days)
Show older comments
In our signal processing course we were asked to pass a signal through a lpf that had lower the amplitude by at least 20db at w=200pi but not change the signal at w=20pi the signal is:
Xct=exp((-3)*t).*(cos(20*pi*t)+cos(200*pi*t))
and the filter we built is:
LPF=tf(3969*pi^2, [1 126*pi 3969*pi^2])
we built this filter using the bode function; making sure that the amplitude of the filter alone would be 0db until half a decade before w=200pi.
however, when we pass the signal through the filter, the signal is amplified where is shouldn't be: the code is:
Y=Xcs*LPF; %frequency plane LPFt=(3969*pi^2).*exp(-63*pi*t).*t; yt=conv(Xct, LPFt);
when xcs is the laplace transform of xct. we calculated the laplace transform outside of matlab and entered it with this code:
zero=[-3; -3+i*446.504; -3-i*446.504]; pole=[-3+i*20*pi; -3-i*20*pi; -3+i*200*pi; -3-i*200*pi]; k=2; [b a]=zp2tf(zero, pole,k); Xcs=tf(b,a);
Can someone please explain why the signal is amplified? or if we've done something wrong in the matlab code Thanks in advance
0 Comments
Answers (1)
Hari
on 11 Jun 2025
Hi,
I understand that you designed a low-pass filter (LPF) with the goal of attenuating frequencies at ω=200π\omega = 200\pi by at least 20 dB and leaving ω=20π\omega = 20\pi unchanged. However, when you applied this filter to your signal in MATLAB, the output showed unexpected amplification.
I assume that your system is linear and time-invariant, and that you're working in the Laplace domain before converting back to time domain using convolution with the impulse response.
In order to analyze why the signal appears amplified, you can follow the below steps:
Step 1: Check the gain of the filter at desired frequencies
Use bode(LPF) or freqresp to verify that the filter has 0 dB (gain = 1) at ω=20π\omega = 20\pi and ≤ –20 dB at ω=200π\omega = 200\pi. A mistake in normalization or coefficient scaling could have led to unexpected gain.
Step 2: Verify proper scaling of Laplace-domain signal Xcs
You manually constructed Xcs from Laplace transform using zeros, poles, and gain. Make sure the scaling factor k is correct. If the Laplace transform was calculated symbolically, its magnitude could be off due to neglected constants.
Step 3: Ensure proper use of convolution and impulse response
When you use convolution yt = conv(Xct, LPFt), ensure both vectors are sampled properly and LPFt represents the impulse response of the filter. Also, convolution increases the signal length; truncate or adjust time axis accordingly.
Step 4: Normalize the convolution output if needed
If the impulse response was not normalized or time vector t has coarse sampling, the convolution output might be scaled. Normalize yt appropriately or scale by sampling interval dt if applicable.
Step 5: Prefer lsim for filtering over manual convolution
Instead of manually convolving with the impulse response, use:
yt = lsim(LPF, Xct, t);
This uses numerical integration and takes care of system dynamics and time alignment better.
References:
Hope this helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!