You are on page 1of 48

Example for Laplace

transform
Homeworks
• Problem A 2-1, 2-2 to 2-5, 2-15 to 2-17 & 2-19 to 2-20
• We will have a quiz on Wednesday Feb 19 & Feb21
EXAMPLE 2-1: 2nd-ORDER ODE
(Overdamped Case) constant Step Function

constant
a. ODE solution
a. ODE Solution
(a4)
b. Laplace transform solution
b. Laplace Transform Solution

Remind:
𝓛 𝒙ሶ 𝒕 = 𝓛 𝒙 𝒕 − 𝒙 𝟎
𝓛 𝒙ሷ 𝒕 = 𝒔𝓛 𝒙ሶ 𝒕 − 𝒙ሶ 𝟎 = 𝒔 𝒔𝓛 𝒙 𝒕 − 𝒙 𝟎 − 𝒙ሶ 𝟎 = 𝒔𝟐 𝓛 𝒙 𝒕 − 𝒔𝒙 𝟎 − 𝒙ሶ (𝟎)
Equal to particular solution 𝑥𝑝
Equal to particular solution 𝐴1
1st constant of the homogeneous solution 𝑥ℎ

Equal to particular solution 𝐴2


2nd constant of the homogeneous solution 𝑥ℎ
c. Matlab Solution
(Put parameter values
into the analytic result)
d. Euler Method
% MATLAB File: "Example: 2nd-Order_ODE_(Overdamped_Case).m"
%
clear all,clf reset,clc,cla
a0=1,a1=3,a2=2 % Define the ODE
s=roots([a0 a1 a2]) % Find & print the characteristic roots
x0=1,v0=2,F0=3,t0=3 % Define IC's, forcing function/pulse strength & pulse duration
A1=(-s(2)*x0+v0+s(2)*F0/a2)/(s(1)-s(2))
A2=(-s(1)*x0+v0+s(1)*F0/a2)/(s(2)-s(1))
% Find the residues
num=[a0*x0,a1*x0+a0*v0,F0]; % Define the numerator
den=conv(conv([a0,0],[1,-s(1)]),[1,-s(2)]); % Define the denominator
[r,p,k]=residue(num,den)
% Initialize the arrays
t_min=0;t_max=10;time_step=101;delta_t=(t_max-t_min)/(time_step-1);
t(1)=t_min;x_Exact(1)=x0;x_Euler(1)=x0;v_Euler(1)=v0; A1 A2
% Compute step responses using exact and Euler methods
for k=2:time_step
t(k)=t_min+(k-1)*delta_t;
x_Exact(k)=A1*exp(s(1)*t(k))+A2*exp(s(2)*t(k))+F0/a2;
x_Euler(k)=x_Euler(k-1)+v_Euler(k-1)*delta_t;
v_Euler(k)=(F0-a1*v_Euler(k-1)-a2*x_Euler(k-1))*delta_t/a0+v_Euler(k-1);
end

% Plot step responses


figure (1)
plot(t,x_Exact,t,x_Euler,'+')
xlabel('\fontsize{12}\bf\it{t}')
ylabel('\fontsize{12}\bf\it{x(t)}')
legend('Exact','Euler')
title('\fontsize{14}\bf2nd-Order ODE: \it{a_0d^2x/dt^2+a_1dx/dt+a_2x=F_0 (step)}')
grid
e. Input: Ramp Function
Remind
f1.Input: Pulse Function
(ODE)
ODE

Initial Conditions become


𝑥(𝑡0 )
Part 1 Part 2 ቊ
𝑥ሶ (𝑡0 )
f1.Input: Pulse Function
(Laplace Transform)

You might also like