Plot the graph of f(t).

advertisement
1. Plotting Graph with Matlab:
Exponential-Harmonic Function:
Exponential-Harmonic functions are functions commonly encountered in
engineering applications as the form of excitation or response. The general
form of an exponential-harmonic function includes amplitude A, damping
term σ, which determines the rate of decay, frequency of oscillation ω and
phase angle φ.

f (t )  Ae  t cos( t   )
T    2
Phase angle
Amplitude
Frequency (rad/s)
T: Duration for one
cycle, Period (s)
Damping
T  2
2
1
  , f  ,   2f
T
T
ω= Angular frequency (rad/s)
f : Frequency (Hz)

f ( t )  5 e 0.2 t cos (4t )
5
4
cos (4t )
5 e 0.2 t
3
Red curve is exponential term
2
f(t)
1
Black curve is harmonic term
0
-1
-2
Blue curve is function f(t)
-3
-4
-5
0
2
4
6
8
10
12
14
Time (s)
5
f (t )  5 e 0.2 t cos (4t  1.2)
f(t)
  1.2 rad
0
-5
0
2
4
6
8
Time (s)
10
12
14
Phase angle φ represents
the shift in x axis. Negative
phase angle means shift to
the right, positive phase
angle means shift to the
left.
Euler formula:
e
i (  t )
 cost    i sin t  
Real part (Re)
We can rearrange f(t) using Euler formula



Imaginary part (Im)

 
f (t )  Re Ae t ei (t )  Re Ae ie( i) t  Re Cept
Where C=Aeiφ and p=-σ+iω. p is a complex number and it can be
shown in complex plane with its real and imaginary parts.
Im
p
o

-σ
iω
Re
The magnitude of p is ω0
0T0  2
The rate of decay in the function f(t) is determined by the damping
ratio ξ. If α=0º then ω=0 and ξ=1. It means that there is no
oscillation and f(t) is a decaying exponential function. If α=90º then
σ=0 and ξ=0. It means that there is no exponential decay and
function f(t) is an harmonic function. The rate of decay is
determined by the damping ratio ξ. The damping ratio is calculated
as
2
2
2

  cos  
0
0   2  2
0    
   0
  0 1   2
02   2 02  2
There are two important time values in plotting functions. One of them is the time
increment Δt, which is the interval between two adjaent function points, and the
other one is the end time ts, at which the function reaches its final value (the value
of function does not change as the time increases). These two time values can be
calculated by using period T0 and damping ratio ξ.
x(t )  e  t cos( 1   2 t )
T0
t 
20
1
x(t)
T0
ts 

A=1, ω0=1 rad/s
0.5
0.2
ξ=0.1
t
Effect of damping ratio.
Problem 1.1:
Plot the graph of function f(x)
f ( x )  2.5e
 0.2 x
cos( 3x  1.8)
As seen from the function, the independent variable is a coordinate. But, the
soluton method is the same.
k 0  ( 0.2)2  3 2  3.0067
p=-0.2+3i
Im
3i
0.2
  cos() 
 0.0665
0
2.09
3.0067
xs 

 31.43
6.28
 0.0665
 2.09
k 0  0  2  0 
3.0067
k0
α
-0.2
 0 2.09
x 

 0.1045
20
20
Re
Plotting of f(x) with Matlab
clc;clear;
x=0:0.1045:31.43;
f=2.5*exp(-0.2*x).*cos(3*x-1.8);
plot(x,f)
Dot product
Dot product should be used to multiply the corresponding elements
of two vectors.
A=[1 4 6 8], B=[6 3 8 7]
A is 1x4 vector and B is 1x4 vector.
* means matrix multiplication.
C=A*B
Error: inner matrix dimensions must agree
C=A.*B =[6 12 48 56]
f ( x )  2.5e
 0.2 x
cos( 3x  1.8)
2
Δx=0.4
1
Details of f(x) are not seen if
Δx is not choosen properly.
0
-1
-2
0
5
10
15
20
25
30
35
Exponential Function:
f (t )  Ae
 t
x(t)  e
x(t)
 : Time cons tan t
1



t

3
Problem 1.2:
1
 1.56
0.64
Always
positive
5
 2
f ( x )  4.2e  0.64x
Plot the graph of f(x).

  10

t  t
 s
t
The decay ratio increases as the time
constant decreases.
Matlab Code:
clc;clear;
x=0:0.5:9.8;
f=4.20*exp(-0.64*x);
plot(x,f)
x 
1.56
 0.5
3.14
x s  6.28 1.56  9.8
f (t )  3e7t cos(5t  1.9)  2e3t cos(10t  2.3)  3e0.5t
Problem 1.3:
Plot the graph of f(t).
ξ
p
∆t
ts
-7+ 5i
0.81 0.0365
0.9
-3+10i
0.29 0.0301
2.94
-0.5
-
12.56
t  0.0301
0.64
t s  12.56
Important!
Use smallest Δt and greatest ts.
Matlab Code:
clc;clear;
t=0:0.0301:12.56;
f=3*exp(-7*t).*cos(5*t+1.9)-2*exp(-3*t).*cos(10*t-2.3)+3*exp(-0.5*t);
plot(t,f)
Summation of Harmonic Functions: Periodic Function
Problem 1.4:
f (t )  2 cos(3t  1.7)  4 cos(6t  2.1)  3.2 cos(9t  0.65)
3T1  2
T1  2.093
6T2  2
T2  1.047
9T3  2
T3  0.70
t s  2.093
t 
0.70
 0.035
20
ξ=0 and then ts=T0
Plot each part of function f(t) seperately and plot f(t).
f (t )  2 cos(3t  1.7)  4 cos(6t  2.1)  3.2 cos(9t  0.65)
2cos(3t-1.7)
clc;clear;
t=0:0.0035:2.093;
x1=2*cos(3*t-1.7);
x2=-4*cos(6*t+2.1);
x3=3.2*cos(9*t-0.65);
subplot(2,2,1);plot(t,x1)
subplot(2,2,2);plot(t,x2)
subplot(2,2,3);plot(t,x3)
x=x1+x2+x3;
subplot(2,2,4);plot(t,x)
pause
x=[x,x,x];
close figure(1)
plot (x)
f(t)
4cos(6t+2.1)
3.2cos(9t-0.65)
Download