Question: This script determines the initial zero crossing of the % underdamped response of a parallel RLC circuit. The % underdamped response is: % v (

This script determines the initial zero crossing of the
% underdamped response of a parallel RLC circuit. The
% underdamped response is:
% v(t)=exp(-t/(2RC))*(A*cos(sqrt(1/LC-(1/2RC)^2)t)
%+ B*sin(sqrt(1/LC-(1/2RC)^2)t))
% The circuit component values and initial conditions
% are:
% R=100 ohms; L=1.0e-3 henry; C=1.0e-6 farads;
% A=6.0 volt, B=-9.0 volt
% Solve over the interval 0<= t <=0.5e-3 sec
clear; clc;
R=100; L=1.0e-3; C=1.0e-6; A=6.0; B=-9;
fprintf('Example 4.1: Find first zero crossing of ');
fprintf('underdamped RLC circuit
');
tmin=0.0; tmax=0.5e-3;
% split up timespan into 100 intervals:
N=100;
dt=(tmax-tmin)/N;
% First, calculate t and v(t) at each timestep
for n=1:N+1
t(n)= tmin+(n-1)*dt;
v(n)= func_RLC(t(n),A,B,R,L,C);
fprintf('%10.4e %10.3f
,t(n),v(n);
end
plot(t,v), xlabel('t'), ylabel('v'),
title('v vs t for a RLC circuit'), grid;
% Next, use the search method to find the first timestep
% where the sign of v(t) changes. When found, use fzero
% to solve.
for n=1:N
sign = v(n)*v(n+1);
if sign <=0.0
root_interval(1)=t(n);
root_interval(2)=t(n+1);
% Solve for the zero of the multi-argument
% function func_RLC.m by invoking func_RLC as an
% anonymous function of one variable.
root = fzero(@(t) func_RLC(t,A,B,R,L,C),...
root_interval);
break;
end
end
fprintf('
');
if n < N
fprintf('First zero crossing is at t=%10.4e s
',...
root);
else
fprintf('No roots lie within %g <= t <=%g s
',...
tmin,tmax);
end
% Check solution. Putting root into func_RLC should
% produce zero.
v = func_RLC(root,A,B,R,L,C);
fprintf('v=%8.6e
',v);
----------------------------------------------------------------------------
% func_RLC.m
% This function works with Example_4_1.m
function v=func_RLC(t,A,B,R,L,C)
arg1=1/(2*R*C);
arg3=sqrt(1/(L*C)-1/(2*R*C)^2);
% Equation (4.5):
v=exp(-arg1*t)*(A*cos(arg3*t)+B*sin(arg3*t));
Look at the above programme and find out what is wrong. Discuss as
students and correct if necessary.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!