: Modify the MATLAB m-script to produce a new file with the design of an RLC band-pass filter. Provide its Bode plot. cl
Posted: Mon May 09, 2022 7:33 am
: Modify the MATLAB m-script to produce a new file
with the design of an RLC band-pass filter. Provide its Bode
plot.
clear
close all
%
%*******Parameter Settings********
%
Fs=5000;
%Sampling Frequency
Ts=1/Fs;
%Sampling Period or Sampling Time
N=200;
%Length of each discrete signal or
vector
V=N*Ts;
%Time duration (in seconds) for each
signal
fm=600;
%Cut-off frequency
Wn=2*fm/Fs;
%Normalized frequency
M=200;
%Length of the impulse response
signal
R=100;
%Value of Resistor
C=1/(2*pi*fm*R); %Value of
Capacitor
a=1/(R*C);
%Time Constant Parameter
h0=a;
%Initial Condition Parameter
t=0:Ts:V-Ts;
%General time axis
th=0:Ts:M*Ts-Ts; %Time
axis to plot impulse response signal
f=-Fs/2:Fs/M:Fs/2-Fs/M; %Frequency axis
%
%CAUSAL FIRST-ORDER LOW-PASS RC-FILTER
%
hRC=h0*exp(-a*th); %RC-Filter impulse response
function
hmax=max(hRC); %Maximum value of
impulse response function
hRC=(hRC/hmax); %Normalized impulse
response function
fhRC=fft(hRC); %Fourier Transform
of impulse response function
sfhRC=fftshift(fhRC); %Frequency shift for two-sided
spectrum plot
asfhRC=abs(sfhRC); %Absolute value
calculation
Hmax=max(asfhRC); %Maximum value of frequency
response function
asfhRC=(asfhRC/Hmax); %Normalized frequency response
function
%
%MATLAB IDEAL FIR APPROXIMATION FILTER
%
Wn=(2*fm)/Fs; %Normalized
cut-off frequency for ideal filter
h=fir1(N-1,Wn); %Impulse response
function of ideal filter
fh=fft(h); %Fourier
transform of impulse response function
sfh=fftshift(fh); %Frequency shift for
two-sided spectrum plot
msfh=abs(sfh); %Absolute value calculation
%
%*********************************
%**********Signals Plots**********
%********************************* %
plot(f,asfhRC,f, msfh,'r') %Plots of RC & Ideal
filters
% grid
xlabel('Frequency in Hz.') %Horizontal axis
ylabel('Magnitude') %Vertical
axis
title('HL(f) and HRC(f)') %Title of plot
%
figure
plot(f,20*log10(asfhRC),f,20*log10(msfh),'r') %Plots of RC &
Ideal filters
grid
xlabel('Frequency in Hz.') %Horizontal
axis
ylabel('20*Log10 (Magnitude)') %Vertical axis
title('HL(f) and HRC(f)') %Title of plot
axis([min(f) max(f) -100 +50]);
The impulse response function of the RC-filter is denoted h(t): 1 h(t) = T{8(t)} = h,e-Btu(t); B = RC' ho = B = =
Its step response function is denoted s(t): s(t) = T{u(t)} = B(1 - e-bt)u(t) =
with the design of an RLC band-pass filter. Provide its Bode
plot.
clear
close all
%
%*******Parameter Settings********
%
Fs=5000;
%Sampling Frequency
Ts=1/Fs;
%Sampling Period or Sampling Time
N=200;
%Length of each discrete signal or
vector
V=N*Ts;
%Time duration (in seconds) for each
signal
fm=600;
%Cut-off frequency
Wn=2*fm/Fs;
%Normalized frequency
M=200;
%Length of the impulse response
signal
R=100;
%Value of Resistor
C=1/(2*pi*fm*R); %Value of
Capacitor
a=1/(R*C);
%Time Constant Parameter
h0=a;
%Initial Condition Parameter
t=0:Ts:V-Ts;
%General time axis
th=0:Ts:M*Ts-Ts; %Time
axis to plot impulse response signal
f=-Fs/2:Fs/M:Fs/2-Fs/M; %Frequency axis
%
%CAUSAL FIRST-ORDER LOW-PASS RC-FILTER
%
hRC=h0*exp(-a*th); %RC-Filter impulse response
function
hmax=max(hRC); %Maximum value of
impulse response function
hRC=(hRC/hmax); %Normalized impulse
response function
fhRC=fft(hRC); %Fourier Transform
of impulse response function
sfhRC=fftshift(fhRC); %Frequency shift for two-sided
spectrum plot
asfhRC=abs(sfhRC); %Absolute value
calculation
Hmax=max(asfhRC); %Maximum value of frequency
response function
asfhRC=(asfhRC/Hmax); %Normalized frequency response
function
%
%MATLAB IDEAL FIR APPROXIMATION FILTER
%
Wn=(2*fm)/Fs; %Normalized
cut-off frequency for ideal filter
h=fir1(N-1,Wn); %Impulse response
function of ideal filter
fh=fft(h); %Fourier
transform of impulse response function
sfh=fftshift(fh); %Frequency shift for
two-sided spectrum plot
msfh=abs(sfh); %Absolute value calculation
%
%*********************************
%**********Signals Plots**********
%********************************* %
plot(f,asfhRC,f, msfh,'r') %Plots of RC & Ideal
filters
% grid
xlabel('Frequency in Hz.') %Horizontal axis
ylabel('Magnitude') %Vertical
axis
title('HL(f) and HRC(f)') %Title of plot
%
figure
plot(f,20*log10(asfhRC),f,20*log10(msfh),'r') %Plots of RC &
Ideal filters
grid
xlabel('Frequency in Hz.') %Horizontal
axis
ylabel('20*Log10 (Magnitude)') %Vertical axis
title('HL(f) and HRC(f)') %Title of plot
axis([min(f) max(f) -100 +50]);
The impulse response function of the RC-filter is denoted h(t): 1 h(t) = T{8(t)} = h,e-Btu(t); B = RC' ho = B = =
Its step response function is denoted s(t): s(t) = T{u(t)} = B(1 - e-bt)u(t) =