In this exercise we will determine the output of the ideal lowpass filter with b
ID: 1716447 • Letter: I
Question
In this exercise we will determine the output of the ideal lowpass filter with bandwidth B and delay to = 0, assuming that its input z(t) is a rectangular pulse of unit amplitude and duration T. The frequency response of the filter is shown in the next figure. -B We recall that the impulse response of an ideal lowpass filter with bandwidth B is h(t) = 2Bsine(201). Create an M-file that: (a) plots the input to the filter, a(t), where t ranges from -10 to 10 using 0.01 increments. Assume that T = 5; (b) plots the impulse response h(t), where t ranges from -10 to 10 using 0.01 increments. Assume that B = 2;Explanation / Answer
M-file for (a),(b),(c) and (d)
clc;
clear all;
T=5;
B=2;
t=-10:0.01:10;
x=heaviside(t)-heaviside(t-T);
subplot(2,1,1);
plot(t,x);
xlabel('Time(t)');
ylabel('Amplitude');
title('Input (T=5,B=2)');
h=2*B*sinc(2*B*t);
subplot(2,1,2);
plot(t,h);
xlabel('Time(t)');
ylabel('Amplitude');
title('Filter (T=5,B=2)');
y=conv(x,h);
ty=-20:0.01:20;
figure;
plot(ty,y);
xlabel('Time(t)');
ylabel('Amplitude');
title('Output (T=5,B=2)');
%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
B1=1;
h1=2*B1*sinc(2*B1*t);
subplot(2,1,1);
plot(t,h1);
xlabel('Time(t)');
ylabel('Amplitude');
title('Filter (T=5,B=1)');
B2=4;
h2=2*B2*sinc(2*B2*t);
subplot(2,1,2);
plot(t,h2);
xlabel('Time(t)');
ylabel('Amplitude');
title('Filter (T=5,B=4)');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
y1=conv(x,h1);
subplot(2,1,1);
plot(ty,y1);
xlabel('Time(t)');
ylabel('Amplitude');
title('Output (T=5,B=1)');
y2=conv(x,h2);
subplot(2,1,2);
plot(ty,y2);
xlabel('Time(t)');
ylabel('Amplitude');
title('Output (T=5,B=4)');
M-file for (e)
clc;
clear all;
T=5;
B=1;
Fs=20;
t=-10:0.01:10;
x=heaviside(t)-heaviside(t-T);
h=2*B*sinc(2*B*t);
y=conv(x,h);
N=length(h);
dF = Fs/N;
f = -Fs/2:dF:Fs/2-dF;
xf=fftshift(fft(x));
subplot(3,1,1);
plot(f,abs(xf)/N);
xlabel('frequency(f)');
ylabel('Amplitude');
title('Magnitude spectrum of Input(T=5,B=1)');
hf=fftshift(fft(h));
subplot(3,1,2);
plot(f,abs(hf)/N);
xlabel('frequency(f)');
ylabel('Amplitude');
title('Magnitude spectrum of Filter (T=5,B=1)');
Ny=length(y);
dFy = Fs/Ny;
fy = -Fs/2:dFy:Fs/2-dFy;
yf=fftshift(fft(y));
subplot(3,1,3);
plot(fy,abs(yf)/Ny);
xlabel('frequency(f)');
ylabel('Amplitude');
title('Magnitude spectrum of Output (T=5,B=1)');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
B=4;
x=heaviside(t)-heaviside(t-T);
h1=2*B*sinc(2*B*t);
y1=conv(x,h1);
figure;
xf=fftshift(fft(x));
subplot(3,1,1);
plot(f,abs(xf)/N);
xlabel('frequency(f)');
ylabel('Amplitude');
title('Magnitude spectrum of Input (T=5,B=4)');
hf1=fftshift(fft(h1));
subplot(3,1,2);
plot(f,abs(hf1)/N);
xlabel('frequency(f)');
ylabel('Amplitude');
title('Magnitude spectrum of Filter (T=5,B=4)');
yf1=fftshift(fft(y1));
subplot(3,1,3);
plot(fy,abs(yf1)/Ny);
xlabel('frequency(f)');
ylabel('Amplitude');
title('Magnitude spectrum of Output(T=5,B=4)');
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.