Lab 13

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Lab. NO.

:13

To Plot the Frequency Response (Magnitude and Phase response) of system transfer
function.
Lab. Objective:

To know about magnitude and phase response and plot these in Matlab for different systems transfer
functions.

Tools: Matlab, PC.

Theory:

Frequency Response:

Frequency response represent the change in output of a system w,r,t input for every frequency value.

Magnitude Response:

magnitude response represent the increase/ decrease in output of the system w,r,t every frequency value.

Phase Response:

response represent the change in phase of input sinusoids w,r,t every frequency.

Plotting of Magnitude and Phase response:

Matlab Code:

%%plotting of magnitude and phase response of system transfer function%%

%H(s)= s-1/s+2% defining transfer function of the system

num=[1 -1];%defining numerator of the system

den=[1 2];%defining numerator of the system

freqz(num,den)%Matlab built-inn command for plotting magnitude and phase responce

title('magnitude and phase responce of system')%Matlab built-inn command for title on the graph

grid on%Matlab built-inn command for lines on the graph


magnitude and phase responce of system
20
Magnitude (dB)
0

-20

-40

-60
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

180

160
Phase (degrees)

140

120

100

80
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

Plotting of Magnitude and Phase Response of system transfer function

Matlab Code:

%%plotting of magnitude and phase responce of system transfer function%%

%H(s)= 4s^2-5s+3/10s^2-s+8% defining transfer function of the system

num=[4 -5 3];%defining numerator of the system

den=[10 -1 8];%defining numerator of the system

freqz(num,den)%Matlab built-inn command for plotting magnitude and phase responce

title('magnitude and phase responce of system')%Matlab built-inn command for title on the graph

grid on%Matlab built-inn command for lines on the graph


magnitude and phase responce of system
Magnitude (dB) 10

-10

-20

-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

150
Phase (degrees)

100

50

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

Plotting of Frequency Response in Matlab

Matlab Code:

%%plotting of magnitude and phase responce of system transfer function%%

%H(s)= 7s^5-6s^3+3s^2-2s+4/4s^5-3s^2+8s-3% defining transfer function of the system

num=[7 -6 3 -2 4];%defining numerator of the system

den=[4 -3 8 -3];%defining numerator of the system

freqz(num,den)%Matlab built-inn command for plotting magnitude and phase responce

title('magnitude and phase responce of system')%Matlab built-inn command for title on the graph

grid on%Matlab built-inn command for lines on the graph


magnitude and phase responce of system
10
Magnitude (dB)
0

-10

-20

-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

400

300
Phase (degrees)

200

100

-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

Lab. Assignment:

Laplace and Inverse Laplace Transform of Time domain and Frequency domain sequences

Laplace Transform of sequence:

Given Sequence:

H(t)=e-at+(1-e3t)-(3+e-3t)+e5t
Matlab Work

syms t s % Matlab built-inn command to define t and s

a=1; % defining the variable ‘a’

h=exp(-a*t)+(1-exp(3*t))-(3+exp(-3*t))+exp(5*t) % defining the time domain sequence

F=laplace(h,t,s) %applying laplace transform command

simplify(F) % Matlab built-inn command to simplify the expression

pretty(ans) % Matlab built inn command for writing the expression in mathematical form

h=

exp(-t)-2-exp(3*t)-exp(-3*t)+exp(5*t)
F=

1/(1+s)-2/s-1/(s-3)-1/(s+3)+1/(s-5)

ans =

-2*(s^4-6*s^3-10*s^2+18*s+45)/(1+s)/s/(s-5)/(s^2-9)

s4 - 6 s3 - 10 s 2 + 18 s + 45

-2 -----------------------------

(1 + s) s (s - 5) (s 2 - 9)

Inverse Laplace Transform of a given Transfer function:

syms t s % Matlab built-inn command to define t and s

F=1/(s-1)*(s+2); % defining the frequency domain sequence

F1=ilaplace(F) %applying inverse laplace transform command

F2=simplify(F1) % Matlab built-inn command to simplify the expression

pretty(F2) % Matlab built inn command for writing the expression in mathematical form

F1 =

dirac(t)+3*exp(t)

F1 =

dirac(t)+3*exp(t)

ans =

dirac(t)+3*exp(t)

F1 =

dirac(t)+3*exp(t)

F2 =

dirac(t)+3*exp(t) dirac(t) + 3 exp(t)

You might also like