Presentation is loading. Please wait.

Presentation is loading. Please wait.

1. Plotting Graph with Matlab:

Similar presentations


Presentation on theme: "1. Plotting Graph with Matlab:"— Presentation transcript:

1 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 φ. T: Duration for one loop, Period (s) Amplitude Damping Frequency (rad/s) Phase angle ω= Angular frequency (rad/s) f : Frequency (Hz)

2 Red curve is exponential term
Black curve is harmonic term Blue curve is function f(t) Phase angle φ represents the shift in x axis. Negative phase angle means shift to the right, positive phase angle means shift to the left.

3 We can rearrange f(t) using Euler formula
Real part (Re) Imaginary part (Im) We can rearrange f(t) using Euler formula Where C=Aeiφ and p=-σ+iω. p is a complex number and it can be shown in complex plain with its real and imaginary parts. The magnitude of p is ω0 p Im Re 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

4 Effect of damping ratio.
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 ξ. 1 0.2 0.5 ξ=0.1 t x(t) A=1, ω0=1 rad/s Effect of damping ratio.

5 Problem 1.1: Plot the graph of function f(x) As seen from the function, the independent variable is a coordinate. But, the soluton method is the same. p=-0.2+3i Im 3i k0 -0.2 α 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

6 Dot product should be used to multiply the corresponding elements of two vectors.
A=[ ], B=[ ] A is 1x4 vector and B is 1x4 vector. * means matrix multiplication. C=A*B Error: inner mattrix dimensions must agree C=A.*B =[ ] Δx=0.4 Details of f(x) are not seen if Δx is not choosen properly.

7 Exponential Function:
5 3 The decay ratio increases as the time constant decreases. Problem 1.2: Plot the graph of f(x). x(t) Always positive Matlab Code: clc;clear; x=0:0.5:9.8; f=4.20*exp(-0.64*x); plot(x,f)

8 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 - 0.64 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)

9 Summation of Harmonic Functions: Periodic Function
Problem 1.4: ξ=0 and then ts=T0 Plot each part of function f(t) seperately and plot f(t).

10 f(t) clc;clear; t=0:0.0035:2.093; x1=2*cos(3*t-1.7);
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 ppt "1. Plotting Graph with Matlab:"

Similar presentations


Ads by Google