0% found this document useful (0 votes)
10 views38 pages

Digital Simulation Lab Report ECE 2023

Uploaded by

santho shree
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)
10 views38 pages

Digital Simulation Lab Report ECE 2023

Uploaded by

santho shree
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

Name : P S ANUSRI

Register No : 231081101005

Degree : B-TECH

Branch : ECE

Year/Section : II YEAR/A-SEC

Subject Code EBEC22L04


Subject Name Digital Simulation Lab
Batch 2023-2027

[1]
BONAFIDE CERTIFICATE

Register No: 231081101005

Name of the Lab: Digital Simulation Lab

Department: B-TECH (ECE)

Certified that this is a bonafide of record work done by __________________________________ of

the __________ class in the C++ and Java Programming Laboratory in the academic year
____________

Signature of Lab-In-Charge Signature of Head of Department

Submitted for the practical examination held in _______________

Internal Examiner External Examiner

[2]
LIST OF EXPERIMENTS
Name of the Experiment Page NO. Faculty Signature
[Link].

SIGNALS AND SYSTEMS

1 Generation of Signal Sequence

2 Sampling & Waveform Generation

Representation of Time-Series; Computation Of


3
Convolution

4 Stability of LTI System.

5 Dft & Idft Computation

CONTROL SYSTEM

6 Impulse Response of First and Second Order Systems

Time Domain Specifications for Closed Loop Transfer


7
Function

Bode Plot and Polar Plot For Open Loop System


8

Stability Check Using Routh-Hurwitz Criterion bode Plot


9 and Root Locus.

Determination of Controllability, Observability and


10
Transfer Function from State Model

[3]
SIGNALS AND SYSTEMS

[4]
Expt. No.01

Date:

GENERATION OF DIFFERENT SIGNALS

AIM:

To write a program in MATLAB to generate different test signals

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER

THEORY:
Unit Step Function
Unit step function is denoted by u(t). It is defined as u(t) = {10t⩾0t<0{1t⩾00t<0

 It is used as best test signal.


 Area under unit step function is unity
Exponential Signal
Exponential signal is in the form of x(t) = eαteαt.
The shape of exponential can be defined by αα.
Case i: if αα = 0 →→ x(t) = e0e0 = 1

[5]
Case ii: if αα < 0 i.e. -ve then x(t) = e−αte−αt. The shape is called decaying exponential.

Case iii: if αα > 0 i.e. +ve then x(t) = eαteαt. The shape is called raising exponential.

Unit Impulse Function


Impulse function is denoted by δ(t). and it is defined as δ(t) = {10t=0t≠0{1t=00t≠0

∫∞−∞δ(t)dt=u(t)∫−∞∞δ(t)dt=u(t)
δ(t)=du(t)dtδ(t)=du(t)dt

Ramp Signal
Ramp signal is denoted by r(t), and it is defined as r(t) = {t0t⩾0t<0{tt⩾00t<0

∫u(t)=∫1=t=r(t)∫u(t)=∫1=t=r(t)
u(t)=dr(t)dtu(t)=dr(t)dt

Area under unit ramp is unity.

[6]
PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

PROGRAM:

clc
close all
clear all
t=-2:1:2;
y=[zeros(1,2), ones(1,1), zeros(1,2)];
subplot(2,2,1);
stem(t,y);
ylabel('d(n)');
xlabel('unit impulse');
n=input('Enter n values');
t=0:1:n-1;
y1=ones(1,n);
subplot(2,2,2);
stem(t,y1);
ylabel('Amplitude');
xlabel('unit step');
n=input('Enter n values');
t=0:1:n-1;
subplot(2,2,3);
stem(t,t);
ylabel('Amplitude');
xlabel('unit ramp');
n=input('Enter length of exponential seq');
t=0:1:n-1;
a=input('Enter a value');
y2=exp(a*t);
subplot(2,2,4);
stem(t,y2);
xlabel('Exponential fun');
ylabel('Amplitude');

[7]
OUTPUT:

RESULT:

[8]
Expt. No.02

Date:

SAMPLING AND WAVEFORM GENERATION

AIM:

To write a program in MATLAB for sampling and waveform generation

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER

THEORY:
Triangular Signal
Let it be denoted as x(t)

Sinusoidal Signal
Sinusoidal signal is in the form of x(t) = A cos(w0±ϕw0±ϕ) or A sin(w0±ϕw0±ϕ)

[9]
Where T0 = 2πw0

Square Signal
Let it be denoted as x(t) and it is defined as

PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

PROGRAM:

Plot an sinusoidal sequence


N=50; n=0:1:N-1;
xn=cos(0.2*pi.*n); subplot(2,2,1),stem(n,xn); subplot(2,2,2),plot(n,xn);
xlabel('n');
ylabel('xn');
title('Sinusoidal Sequence'); xn=sin(0.2*pi.*n);
ubplot (2,2,3),stem(n,xn); subplot(2,2,4),plot(n,xn);
xlabel('n');
ylabel('xn');
title('Sinusoidal Sequence');

[10]
OUTPUT :

Triangular wave generation


y=0:0.5:2;
for j=0:3
x=(4*j)+y;
plot(x,y)
hold on
end
for k=0:3
x=(4*k)-y;
plot(x,y)
hold on
end
hold off
OUTPUT :

[11]
Sawtooth wave generation
y=0:.5:2 ;
for j=0:8
a=(2*j)+y;
plot(a,y,'b') hold on
end x=2:2:18;
for k=0:.01:2 b=k; plot(x,b,'b') hold on
end
hold off

OUTPUT :

generation of square wave


y=0:.001:2; for j=0:2:12 x=y; plot(j,x,'r'); hold on;
end
for k=0:4:12 x=k+y;
m=2;
plot(x,m,'r') hold on
end
for k=2:4:12 x=k+y;
m=0;
plot(x,m,'r'); hold on;
end
hold off
axis([0 12 -0.5 2.5])

[12]
OUTPUT :

RESULT

[13]
Expt. No.03

Date:

REPRESENTATION OF TIME –SERIES COMPUTATION OF


CONVOLUTION

AIM:

To write a program in MATLAB for sampling and waveform generation

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER

THEORY
 Linear convolution is the basic operation to calculate the output for any linear time invariant
system given its input and its impulse response.
 Circular convolution is the same thing but considering that the support of the signal is periodic
(as in a circle, hence the name).
 Most often it is considered because it is a mathematical consequence of the discrete Fourier
transform (or discrete Fourier series to be precise):
 One of the most efficient ways to implement convolution is by doing multiplication in the
frequency.

PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

[14]
PROGRAM:
Linear Convolution program

x=[1 4 2 4 1 1]; h=[1 2 3 4 5];


len1=length(x);
len2=length(h);
len=len1+len2-1;
a=fliplr(h);
for i=1:len c(i)=0;
for j=1:len1
if j>i continue;
end
if(len2-i+j)<=0 continue;
end
c(i)=c(i)+(x(j)*a(len2-i+j));
end
end
k=1:len;
conv_op1=c(1:len)
subplot(2,1,1),stem(k,conv_op1);
title('linear convolution method')

OUTPUT:

[15]
Circular Convolution program
clc
clear all
close all
%circular convolution of the two sequences
hc = [1,1,1,1,2,2,2,2];
xc = [1,2,3,3,1,1,1,1];
disp('Result of Circular Convolution:');
%Outputting Text to Command Console
%Determine Lengths of Inputs
N1 = length(hc);
N2 = length(xc);
%Step 1: If Inputs are of Different Lengths, Zero Pad the Shorter input
if(N1 ~= N2)
if(N2 > N1)
N = N2;
tmp = hc;
hc = zeros(1,N);
for k = 1:N1
hc(1,k) = tmp(1,k);
end
else
N = N1;
tmp = xc;
xc = zeros(1,N);
for k = 1:N2
xc(1,k) = tmp(1,k);
end
end
else
N = N1;
end
Output = zeros(1,N);
%Initialize Output to Contain N Samples
Input2r = zeros(1,N);
%Initialize Circular Time Reversal Array

%Step 2: Find Circular, Time Reversed Input:


for k = 1:N
if(k == 1)
%Keep First Sample Same for Time-Reversed Sequence
Input2r(1,k) = xc(1,1);
else
Input2r(1,k) = xc(1,N-k+2);
end
[16]
end
Input2rs = zeros(1,N);
%Initialize Circular Shift Array to N Samples

%Step 3: Calculate The Output


for n = 0:N-1
for k = 1:N
k1 = 0;

%Peform Circular Shift:


if(k+n <= N)
Input2rs(1,n+k) = Input2r(1,k);
k1 = k+n;
else
Input2rs(1,n+k-N) = Input2r(1,k);
k1 = n+k-N;
end
Output(1,n+1) = hc(1,k1)*Input2rs(1,k1) + Output(1,n+1);
end
end
y=Output
m=1:N;
subplot(2,1,1),stem(m,y);
title('circular convolution method')

OUTPUT:

RESULT:

[17]
Expt. No.04

Date:

STABLITY OF LTI SYSTEMS

AIM:

To write a program in MATLAB to check the stability of LTI the systems.

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER
THEORY:
 If a system in equilibrium is disturbed and the system returns back to the equilibrium point
with time, then the equilibrium point is said to be stable
 In signal processing, specifically control theory, bounded-input, bounded-output (BIBO)
stability is a form of stability for linear signals and systems that take inputs. If a system is
BIBO stable, then the output will be bounded for every input to the system that is bounded.
 LTI system is stable if its impulse response is absolutely summable ie ,finite
∑k=−=h(k)|<∞ where varies from -∞ to +∞
PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

PROGRAMS:
To check stability of a system
num=[1 0.8];
den=[1 1.5 .9];
N=200;
h=impz(num,den,N+1);
sum=0;
n=0:N;
for k=1:N+1

[18]
if abs(h(k))<10^(-6);break
end
sum=sum+h(k);
end
stem(n,h);
grid;
disp('Value='), disp(sum)

OUTPUT:

RESULT:

[19]
FORM NO.F/TL/018

Expt. No.05

Date:

DFT AND IDFT COMPUTATION

AIM:

To write a program in MATLAB for designing a DFT and IDFT of any two N values Of
sequences and plot the magnitude and phase.

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER
THEORY:
 The discrete Fourier transform (DFT) converts a finite sequence of equally- spaced
samples of a function into a same-length sequence of equally-spaced samples of the discrete-
time Fourier transform (DTFT), which is a complex-valued function of frequency. The interval
at which the DTFT is sampled is the reciprocal of the duration of the input sequence.
 An inverse DFT(IDFT) is a Fourier series, using the DTFT samples as coefficientsof
complex sinusoids at the corresponding DTFT frequencies. It has the same sample-values as
the original input sequence.
 The DFT is therefore said to be a frequency domain representation of the original input
sequence.
 The DFT is also used to efficiently solve partial differential equations, and to perform other
operations such as convolutions or multiplying large integers.

PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

[20]
PROGRAM: DFT
Main Program:
clear all;

x=ones(1,4);
%input sequence
N1=8;
%[Link] frequency points
Y1=dft(x,N1);
k=0:1:N1-1;
subplot(2,2,1),stem(k,abs(Y1));
xlabel('K'),ylabel('|Y1(k)|');
subplot(2,2,3),stem(k,angle(Y1));
xlabel('K'),ylabel('arg(Y1(k))');
N2=31;
Y2=dft(x,N2);
k=0:1:N2-1;
subplot(2,2,2),stem(k,abs(Y2));
xlabel('K'),ylabel('|Y2(k)|');
subplot(2,2,4),stem(k,angle(Y2));
xlabel('k'),ylabel('arg(Y2(k))');

Actual Program:

function X=dft(xn,N)
L=length(xn);
if(N<L);
error('N must be >=L')
end
x1=[xn zeros(1,N-L)];
for k=0:1:N-1;
for n=0:1:N-1;
p=exp(-i*2*pi*n*k/N);
x2(k+1,n+1)=p;
end
end
X=x1*x2.';

[21]
OUTPUT:

PROGRAM: IDFT

Main Program:
clear all;
X=[4,1+i,0,1-i,0,1+i,0,1-i];
N=length(X);
xn=idft(X,N)

Actual Program:
function xn=idft(X,N)
N=length(X);
for k=0:1:N-1;
for n=0:1:N-1;
p=exp(i*2*pi*n*k/N);
x2(k+1,n+1)=p;
end
end
xn=(X*x2.')/N;

[22]
OUTPUT:

RESULT:

[23]
CONTROL SYSTEM

[24]
Expt. No.06

Date:
IMPULSE RESPONSE OF FIRST AND SECOND ORDER
SYSTEMS
AIM:

To write a program in MATLAB for Impulse Response Of First And Second Order Systems

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER
THEORY:
 The system whose input-output equation is a first order differential equation is called
first order system. The order of the differential equation is the highest degree ofderivative present in an
equation. First order system contains only one energy storing element
 A system whose input-output equation is a second order differential equation is called
Second Order System. There are a number of factors that make second order systems important. They
are simple and exhibit oscillations and overshoot. Higher order systems are based on second order
systems
 An impulse response means the output/ behavior of a system/process when we provide it
with an impulse signal. The Laplace transform of an impulse function is 1, so the impulse response
is equivalent to the inverse Laplace transform of the system's transfer function, for an LTI system.

PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

[25]
PROGRAM:

clc close all


clear all
syms s complex;
M1=s/(s+1);
M2=1/(s^2+1);
disp('impluse response of the system is,');
m1=ilaplace(M1);
m2=ilaplace(M2);
disp(m1) disp(m2)
n=[0,1 0];
d=[0,1,1];
n1=[0,0,1];
d1=[1,0,1];
subplot(2,1,1)
impulse(n,d); grid;
title('impulse response of M1=');
xlabel ('time');
ylabel('amplitude');
subplot(2,1,2)
impulse(n1,d1);
title('impulse response of M2=');
xlabel ('time');
ylabel('amplitude')
OUTPUT:

RESULT:

[26]
Expt. No.07

Date:

TIME DOMAIN SPECIFICATION FOR CLOSED LOOP TRANSFER


FUNCTION
AIM:

To write a program in MATLAB to Time Domain Specification for Closed Loop Transfer
Function.

SOFTWARE REQUIRED:
MATLAB SOFTWARE

HARDWARE REQUIRED:
PERSONAL COMPUTER

THEORY:
Delay time td: It is the time required for the response to reach 50% of the steady state value for the first
time
Rise time tr: It is the time required for the response to reach 100% of the steady state value for under
damped systems. However, for over damped systems, it is taken as the time required for the response to
rise from 10% to 90% of the steady state value. Generally the formula of equating Rise time
Peak time tp: It is the time required for the response to reach the maximum or Peak value of the
response.
Settling time ts : It is the time required for the response to reach and remain within a specified tolerance
limits (usually ± 2% or ± 5%) around the steady state value.

PROCEDURE:

 Open the Matlab file


 Type the program in the editor window
 Save the file with .m extention and run the program
 Verify output in command window

[27]
PROGRAM:
clc t=0:0.005:5;
num_cof=[0 0 16];
den_cof=[1 4 16];
[c,x,t]=step(num_cof,den_cof,t);n=1;
while c(n)<1.0001;n=n+1;
end;
rise_time=(n-1)*0.005; disp('risetime
of system is ='); disp(rise_time)
[cmax,tp]=max(c); peak_time=(tp-
1)*0.005; disp('peaktime of system is
=');disp(peak_time)
max_0vershoot=cmax-1;
disp('maximum 0vershoot of system is =');
disp(max_0vershoot)
n=1001;
while c(n)>0.95&&c(n)<1.05;n=n-1;
end;
settling_time_5per_err=(n-1)*0.005; disp('Settling
time of system 5per_err is =');
disp(settling_time_5per_err)
n=1001;
while c(n)>0.98&&c(n)<1.02;n=n-1;
end;
settling_time_2per_err=(n-1)*0.005; disp('Settling
time of system 2per_err is =');
disp(settling_time_2per_err)

OUTPUT:




RESULT:



[28]
Expt. No.08
Date:
BODE PLOT AND POLAR PLOT FOR OPEN LOOP SYSTEM

AIM:

To write a program in MATLAB to draw the bode plot and polar plot for the open Loop system

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER

THEORY

 A Bode Plot is a useful tool that shows the gain and phase response of a given LTI system for
different frequencies. Bode Plots are generally used with the Fourier Transform of a given system.

 Polar plot is a plot of magnitude versus phase angle in complex plane. (i.e. locus of magnitude
traced by the phase or by varying frequency from to i n f i n i t y .) Advantage - it can be capture
thesystem behavior over the entire frequency range in a single plot

PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

[29]
PROGRAM:
clc
close all
clear all
syms s complex;
%M1=1/s^2+s+1;
n=[0,0,1];
d=[1,1,1];
grid;
subplot(2,1,1);
bode(n,d);
title('bode plot of M1');
w= 0.4:0.01:4;
[re,im,w]=nyquist(n,d,w);
z=re+i*im;
r=abs(z);
theta=angle(z);
grid;
subplot(2,1,2);
polar(theta,r,'k');
title('polar plot of M');

OUTPUT:

RESULT:

[30]
Expt. No.09

Date:

STABILITY CHECK USING ROUTH HURWITZ CRITERION PLOT

AND ROOT LOCUS

AIM:

To write a program in MATLAB to check the stability using Routh Hurwitz Criterion and Root Locus

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER
THEORY:
 In control system theory, the Routh–Hurwitz stability criterion is a mathematical test that is a
necessary and sufficient condition for the stability of a linear time invariant (LTI) control system. The
Routh test is an efficient recursive algorithm to determine whether all the roots of the
characteristic polynomial of a linear system have negative real parts
 The coefficients of the polynomial are arranged into a square matrix, called the Hurwitz matrix, and
showed that the polynomial is stable if and only if the sequence of determinants of its principal sub
matrices are all positive.
 The two procedures are equivalent, with the Routh test providing a more efficient way to compute the
Hurwitz determinants than computing them directly. A polynomial satisfying the Routh– Hurwitz
criterion is called a Hurwitz polynomial.
 Root locus analysis is a graphical method for examining how the roots of a system change with
variation of a certain system parameter, commonly again within a feedback system. This is a technique
used as a stability criterion in the field of classical control theory which can determine stability
of the system. The root locus plots the poles of the closed loop transfer function in the complex s-
plane as a function of a gain parameter

PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

[31]
PROGRAM:
ROUTH HURWITZ CRITERION
clc;
close all;
clear;
EPS = 0.001; % Small value to avoid division by zero
disp('Routh array for S^3 + 2S^2 + 3S + 1:');
ra = routh([1 2 3 1], EPS);
disp(ra);

disp('Routh array for S^4 + 10S^3 + 2S^2 + 36S + 20:');


ra1 = routh([1 10 2 36 20], EPS);
disp(ra1);
function routh_array = routh(coeffs, EPS)
n = length(coeffs);
routh_array = zeros(n, ceil(n/2));
routh_array(1, :) = coeffs(1:2:end);
if length(coeffs) > 1
routh_array(2, 1:length(coeffs(2:2:end))) = coeffs(2:2:end);
end
for i = 3:n
for j = 1:ceil(n/2)-1
a = routh_array(i-2,1);
b = routh_array(i-2,j+1);
c = routh_array(i-1,1);
d = routh_array(i-1,j+1);

if c == 0
c = EPS;
end

routh_array(i,j) = ((c*b) - (a*d)) / c;


end
if all(routh_array(i,:) == 0)
order = n - i + 1;
prev_row = routh_array(i-1,:);
aux = zeros(1, length(prev_row));
for k = 1:length(prev_row)-1
aux(k) = (order - 2*(k-1)) * prev_row(k);
end
routh_array(i,:) = aux;
end
end
end

[32]
OUTPUT:

PROGRAM:
ROOT LOCUS
clc
close all
clear all
% Root locus
% M1=0.4K/(s^3+2s^2+4s+5
K=2:2:8;
n=[0.4];
d=[1 2 4 5];
subplot(2,1,1)
rlocus(n,d);
[r,k]=rlocus(n,d,K);
subplot(2,1,2)
plot(r,'o');
grid
title ('root locus plot');
xlabel('real axis');
ylabel('imaginary axis');

[33]
OUTPUT

RESULT:

[34]
Expt. No.10

Date:

DETERMINATION OF CONTROLLABLITY AND OBSERVABLITY AND


TRANSFER FUNCTION FROM STATE MODEL
AIM:

To write a program in MATLAB to determine Controllability and Observability and to find Transfer
Function from State Model

SOFTWARE REQUIRED:
 MATLAB SOFTWARE

HARDWARE REQUIRED:
 PERSONAL COMPUTER
THEORY:

 Controllability is concerned with whether one can design control input to steer the state to
arbitrarily values.
 Observability is concerned with whether without knowing the initial state, one can determine the
state of a system given the input and the output.
 A system that is not controllable probably means the followings:
o If state space system is realized from input-output data, then the realization is redundant. i.e.
some states have no relationship to either the input or the output.
o If states are meaningful (physical) variables that need to be controlled, then the design of the
actuators are deficient.
o The effect of control is limited. There is also a possibility of instability

PROCEDURE:
 Open the Matlab file
 Type the program in the editor window
 Save the file with .m extension and run the program
 Verify output in command window

[35]
PROGRAM:
CONTROLLABLITY
clc
close all
clear all
%CONTROLLABLITY
disp('the given state model is,');
A=[0 0 1;-2 -3 0; 0 2 -3]
B=[0;2;0]
C=[1 0 0 ]
D=[0]
disp('Controllablity of matrix is,');
Qc=ctrb(A,B)
disp('Number of uncontrollable states is ');
N_ucs=length(A)-rank(Qc)
disp('determinant of Controllablity matrix is');
Det_Qc=det(Qc)
rank_Qc=rank(Qc)
n=size(A);
if (Det_Qc ~= 0 )&(n==rank_Qc);
disp('system is completely stable.');
else
disp('system is completely unstable.');
end;

OUTPUT:

[36]
PROGRAM:
OBSERVABLITY
clc
close all
clear all
%OBSERVABLITY
disp('the given state model is,');
A=[0 0 1;-2 -3 0; 0 2 -3]
B=[0;2;0]
C=[1 0 0 ]
D=[0]
disp('Observability of matrix is,');
Qo=obsv(A,C)
disp('Number of unobservable states is ');
N_uos=length(A)-rank(Qo)
disp('determinant of Observability matrix is');
Det_Qo=det(Qo)
rank_Qo=rank(Qo)
n=size(A);
if (Det_Qo ~= 0 )&(n==rank_Qo);
disp('system is completely observable.');
else
disp('system is completely not observable.');
end

OUTPUT:

[37]
PROGRAM:
TO FIND TRANSFER FUNCTION
clc;
close all;
clear all;

disp('The given state model is:');


A = [0 1 0; 0 0 1; 2 -5 4];
B = [0; 0; 1];
C = [1 -7 4];
D = 4;

Ts = 0.1; % Sampling time for discrete-time system

% Convert state-space to transfer function


disp('Numerator and Denominator coefficients of the transfer function are:');
[num_cof, den_cof] = ss2tf(A, B, C, D);

% Display transfer function of the discrete-time system


disp('Transfer function of discrete-time system is:');
Gz = tf(num_cof, den_cof, Ts)

OUTPUT:

RESULT:

[38]

You might also like