Modify the given MATLAB m-script file to plot the impulse response function of two RC filters in cascade form. This impu

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Modify the given MATLAB m-script file to plot the impulse response function of two RC filters in cascade form. This impu

Post by answerhappygod »

Modify the given MATLAB m-script file to plot the impulse
response function of two RC filters in cascade
form. This impulse response function is obtained by
performing the convolution of the impulse response functions of the
individual RC circuits. Proceed to plot, also, the magnitude
of the Fourier transform of the impulse response function of two RC
circuits in cascade form. The two RC circuits are not exactly the
same.
Modify The Given Matlab M Script File To Plot The Impulse Response Function Of Two Rc Filters In Cascade Form This Impu 1
Modify The Given Matlab M Script File To Plot The Impulse Response Function Of Two Rc Filters In Cascade Form This Impu 1 (14.5 KiB) Viewed 46 times
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 = =
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply