Professional Documents
Culture Documents
Lab 1
Lab 1
LAB #1
Basic MATLAB Computational Tasks for
Control Systems
BY
Name ID
Submission Date:
Instructor Name:
Method:
1. Installing and prepare MATLAB environment for computational tasks
2. Using MATLAB command window as a computational platform for several control systems
task
3. Develop MATLAB scripts to solve differential equations; plot system response obtain from
Laplace transform solution, present results
4. Prepare report
Lab resources:
1. Computer systems /Laptops
2. MATLAB software
Expected Outcome:
1. Computational results with MATLAB commands in Table format
2. Sample of MATLAB mfile
3. Plot of the system response
4. Report submission
o
a. If θ=30 , determine using Code:
MATLAB the following: %Part A
x=2 e θ %a
Theta_D = 30
Theta_R = Theta_D*(pi/180)
x = 2*exp(Theta_R)
y = cos(1.5*Theta_R)
z = exp(2*Theta_R)*cos(1.5*Theta_R + 0.5)
Code:
%d
[roots, poles] = residue([1 2],[1 7 12 0])
Results:
PART B: System Analysis Application
Figure 1(a) below shows basic capacitive-discharge defibrillator circuit comprises charging and
discharging sub-circuit, while figure 1(b) shows the discharging circuit after the capacitor is
charged to the voltage, V c .
Vc
For a given charged capacitor voltage, ,the transfer function of the output current, I is given as:
s
Vc
I ( s) =
1
L s 2 +s R L +
C
If the capacitor is charged to 20V, C=20 μF , L=0.2 H∧R L =1 K Ω, the current output in time
domain is given by:
i (t )=( 0.02 e−51 t −0.02 e−4950t ) u( t )
a. Write a MATLAB script to plot the current output using MATLAB for 0 ≤ t ≤ 0.5 second at
step of 0.001s.
Copy of your MATLAB script (paste copy of MATLAB codes, neat and well formatted)
Code:
%Part B
t = 0:0.001:0.5;
i = (0.02*exp(-51*t)-0.02*exp(-4950*t));
plot (t,i,'r')
xlabel('Time t sec')
ylabel('Current i A')
title ('Current o/p plot')
b. Present the current output plot (Neat and well label graph)
Results(Plot):
Question Answer
Results:
(ii) Plot the current output using MATLAB for 0 ≤ t ≤ 0.5 second at step of 0.001s.
Code:
%Part a_ii
t = 0:0.001:0.5;
i = (0.02*exp(-25.1*t)-0.02*exp(-4975*t));
plot (t,i,'r')
xlabel('Time t sec')
ylabel('Current I A')
title ('Current o/p plot')
Results:
(iii) Determine the following response parameters from the plot.
Question Answer
Results:
(ii) Plot the current output using MATLAB for 0 ≤ t ≤ 0.5 second at step of 0.001s.
Code:
%Part b_ii
t = 0:0.001:0.5;
i = (0.02*exp(-102.1*t)-0.02*exp(-4898*t));
plot (t,i,'r')
xlabel('Time t sec')
ylabel('Current I A')
title ('Current o/p plot')
Results:
Question Answer
Comparative Table:
Case Capacitor value Value of current at the end of the 0.1 second (mA)
s
1 10 μF 7.36e-07 A = 0.000000736 A
2 20 μF 0.0001282 A
3 40 μF 0.001625 A