0% found this document useful (0 votes)
65 views15 pages

Fahem - HW02

This document contains MATLAB code and results from homework problems on modeling dynamic systems and analyzing time responses. It includes: 1) Code to model a 1st order system and plot the ramp response. 2) Code for a 2nd order system and plot of its impulse response. 3) Code for another 2nd order system and plot of its step response. 4) A discussion comparing the impulse and step responses, noting that the impulse response reaches steady state while the step response shows continuous rotation.

Uploaded by

Ali Fahem
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)
65 views15 pages

Fahem - HW02

This document contains MATLAB code and results from homework problems on modeling dynamic systems and analyzing time responses. It includes: 1) Code to model a 1st order system and plot the ramp response. 2) Code for a 2nd order system and plot of its impulse response. 3) Code for another 2nd order system and plot of its step response. 4) A discussion comparing the impulse and step responses, noting that the impulse response reaches steady state while the step response shows continuous rotation.

Uploaded by

Ali Fahem
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/ 15

FAHEM _HW 02

Section (A) Problem (1)

Page 1 of 15

FAHEM _HW 02

Page 2 of 15

FAHEM _HW 02

Page 3 of 15

FAHEM _HW 02
Section (A)- Problem 3

Page 4 of 15

FAHEM _HW 02

Page 5 of 15

FAHEM _HW 02

% ==========ALI FAHEM =========================


%=== Sectiom A/ Problem 3 =====================
%==============================================
clc
s=tf('s'); % define s to be a tranfer function variable
k=5; %spring constant
b=50; %damping constant
G1=1/(b*s+k); % define system transfer function
% calculate response
% for ramp response, use lsim(sys,f,t)
Td=10; % time scale for display
tmax=4*Td; dt=Td*1e-5; t=0:dt:tmax; % time range
figure(1) % ramp respose using lsim
f=1*t; % ramp forcing function
lsim(G1,f,t)
title('Section A/Problem 3/ ramp response of 1st order system
using lsim')
%============= end
=======================================================

Section A/Problem 3/ ramp response of 1st order system using lsim


40

35

30

Amplitude

25

20

15

10

10

15

20

25

30

Time (seconds)

Section (B)-Problem 4
Page 6 of 15

35

40

FAHEM _HW 02

Page 7 of 15

FAHEM _HW 02

Page 8 of 15

FAHEM _HW 02
%=========== ALI FAHEM===========
%=== Section B/ Problem 4 ========
%
G(s)=(0.5)/(s^2+0.7*s+0.5)
%=================================
t=0:0.01:25;
num=[0.5];
den=[1 0.7 0.5];
sys=tf(num,den)
impulse(sys,t)
sys =
0.5
----------------s^2 + 0.7 s + 0.5
Continuous-time transfer function.

grid
title('impulse response of Section B, Proplem 4')
xlabel('t')
ylabel('response x(t)')
%====== end ============
impulse response of Section B, Proplem 4
0.4
0.35
0.3

response x(t)

0.25
0.2
0.15
0.1
0.05
0
-0.05
-0.1

10

15
t (seconds)

Page 9 of 15

20

25

FAHEM _HW 02
Section (B)- Problem 6

Page 10 of 15

FAHEM _HW 02
Section (C) - Problem 6

Page 11 of 15

FAHEM _HW 02
%====== ALI FAHEM =======================
%Time response Section C Problem 6
clc
s=tf('s'); % define s to be a tranfer function variable
% 2nd order system- Problem 6
k=1;
t=0:0.5:15;
b=200;
J=525;
G1=(k*500)/(J*s^2+b*s); % define system transfer function
% calculate response
figure(1) % impulse response
impulse(G1,t) % impulse response built in function
title('Impulse response Problem 6')
ylabel('Bank Angle')
%=============end===================
Impulse response Problem 6
2.5

Bank Angle

1.5

0.5

10
Time (seconds)

Page 12 of 15

15

FAHEM _HW 02
Section ( C)- Problem 7

Page 13 of 15

FAHEM _HW 02
%====== ALI FAHEM =======================
%Time response Section C Problem 7
clc
s=tf('s'); % define s to be a transfer function variable
% 2nd order system- Problem 7
k=1;
t=0:0.5:15;
b=200;
J=525;
G2=(k*500)/(J*s^2+b*s); % define system transfer function
% calculate response
figure(2) % Step response
step(G2,t) % Step response built in function
title('Step response of Problem 7')
ylabel('Bank Angle')
%=============end===================

Step response of Problem 7


35

30

Bank Angle

25

20

15

10

10
Time (seconds)

Page 14 of 15

15

FAHEM _HW 02
Discussion Problems 6 and 7

From the result of problems 6 and 7, I can see two things.


First, when the pilot activates the aileron by external force, the
aircraft starting rotating around the longitudinal axis that is
similarity.
Second, also I saw a big different in response. When the pilot
activates the aileron of aircraft by impulse function the aircraft
changed has angle to 2.5 degree through 15 seconds and it take
new position with steady state. But, when the input is step
function the aircraft was starting changed has angle with time
without stopping, in other word the aircraft was starting rotating
about has longitudinal axis (unstable)

Page 15 of 15

You might also like