Using the following code plot the impulse response function of two RC filters in cascade form. This impulse response fun

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

Using the following code plot the impulse response function of two RC filters in cascade form. This impulse response fun

Post by answerhappygod »

Using the following code 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. You must assume that the
two filters are not the same.
clear all
close all
Fs=10000; %Sampling Frequency
Ts=1/Fs; %Sampling Period or Sampling Time
N=60; %Length of each discrete signal or vector
V=N*Ts; %Time duration (in seconds) for each signal
fm=1000; %Cut-off frequency
Wn=2*fm/Fs; %Normalized frequency
M=60; %Length of the impulse response signal
R=10000; %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
%RC-FILLTER
hRC=h0*exp(-a*th); %RC-Filter impulse response function
hRCcascade=conv(hRC,hRC).*Ts;%convolution of two RC
responses
hRCcascade=hRCcascade(1:length(th));%truncating cascaded
response to length
%of time axis
hmax=max(hRCcascade); %Maximum value of impulse response
function
hRCcascade=(hRCcascade./hmax); %Normalized impulse response
function
fhRC=fft(hRCcascade); %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
plot(f,asfhRC);
xlabel('f');
ylabel('|H_{cascaded}(f)|');
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply