0% found this document useful (0 votes)
11 views

Lab - 1 Solution

Uploaded by

Youssef Amgad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Lab - 1 Solution

Uploaded by

Youssef Amgad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

10/11/24 7:19 PM C:\User...\Sys_Dyn_and_Ctrl_Comp_Lab_1.

m 1 of 2

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Amr Badra %
% Code : 2001931 %
% Fri Oct 11 20:17:26 2024 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Q1) Appendix B
% Example B-4
num = [2 5 3 6];
den = [1 6 11 6];
sys = tf(num,den)
[r,p,k] = residue(num,den)
% Example B-5
num_1 = [1 2 3];
den_1 = [1 3 3 1];
sys = tf(num_1,den_1)
[r,p,k] = residue(num_1,den_1)
%% Q2) Chapter 2
% MATLAB Program 2-1
num1 = [10];
den1 = [1 2 10];
num2 = [5];
den2 = [1 5];
[nums, dens] = series(num1,den1,num2,den2);
[nump, denp] = parallel(num1,den1,num2,den2);
[numf, denf] = feedback(num1,den1,num2,den2);
printsys(nums,dens)
printsys(nump,denp)
printsys(numf,denf)
% MATLAB Program 2-2
num = [1 0];
den = [1 14 56 160];
[A,B,C,D] = tf2ss(num,den)
% MATLAB Program 2-3
A = [0 1 0; 0 0 1; -5 -25 -5];
B = [0; 25; -120];
C = [1 0 0];
D = [0];
[num,den] = ss2tf(A,B,C,D)
% MATLAB Program 2-5
A = [0 1;-25 -4];
B = [1 1;0 1];
C = [1 0;0 1];
D = [0 0;0 0];
%%% 1 Output
[NUM,den] = ss2tf(A,B,C,D,1)
%%% 2 Outputs
[NUM,den] = ss2tf(A,B,C,D,2)
%% Q3)
syms a t
% part a
10/11/24 7:19 PM C:\User...\Sys_Dyn_and_Ctrl_Comp_Lab_1.m 2 of 2

x1 = t^2 * exp(-a*t) + 3 * t
laplace(x1)
% part b
x2 =exp(-0.1*t) * sin(3*t)
laplace(x2)
% part c
x3 =exp(-0.3*t) * sin(3*t)
laplace(x3)
% part d
x4 =exp(0.1*t) * sin(3*t)
laplace(x4)
% part e
x5 =exp(0.3*t) * sin(3*t)
laplace(x5)
% part f
t = 0:10;
fplot (x2,[0 10]);
hold on
fplot (x3,[0 10]);
grid on; set (gcf,'Color','w');

You might also like