0% found this document useful (0 votes)
27 views2 pages

Experiment number:-TF To SS

The document describes a program that takes in the coefficients of a transfer function and outputs the state space representation matrices A, B, C, and D. The user enters the numerator and denominator coefficients. The program then constructs the A matrix by flipping the denominator coefficients and placing 1s above the diagonal. It sets B as a column vector, C as the numerator coefficients minus the denominator coefficients times the first numerator term, and D as the first numerator term.

Uploaded by

Sachin Shende
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Experiment number:-TF To SS

The document describes a program that takes in the coefficients of a transfer function and outputs the state space representation matrices A, B, C, and D. The user enters the numerator and denominator coefficients. The program then constructs the A matrix by flipping the denominator coefficients and placing 1s above the diagonal. It sets B as a column vector, C as the numerator coefficients minus the denominator coefficients times the first numerator term, and D as the first numerator term.

Uploaded by

Sachin Shende
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Experiment number :- TF to SS

Que. Enter the Transfer Function and get its state space representation.

ANSWER:= (EDITOR WINDOW)

% program for acquiring STATE SPACE REPRESENTATION FROM TRANSFER FUNCTION
clc;
clear all;
close all;
disp('The length of Num & Den must be equal')
num=input('Enter the num coeff. of TF matrix=');
den=input('Enter the den coeff. of TF matrix=');

TF=tf(num,den)
l1=length(den);
l2=length(num);

%for matrix A

A=zeros(l1-1);
for j=1:l1-1 %this for loop will flip the coeft of 'den'
c(1,j) = den(1,l1-(j-1)) ;
end
c=-c;
A(l1-1,:)=c; % replace the last row of A=the flipped DENOMINATOR
for i=1:l1-2 % this loop will make the elements above diagonal =1
A(i,i+1)=1;
end
A
%---------------------------
% for matrix B

o=size(A);
s=o(1,1);
%z=zeros(s-1,1);
%I=eye(1,1);
B=[zeros(s-1,1);eye(1,1)]
%---------------------------
%for matrix C

C=[];
for k=l1:-1:2
C=[C num(1,k)-den(1,k)*num(1,1)] ;
end
C
%---------------------------
%for matrix D

D=[num(1,1)]
%---------------------------



ANSWER:= (COMMAND WINDOW)

The length of Num & Den must be equal
Enter the num coeff. of TF matrix=[3 4 5 4]
Enter the den coeff. of TF matrix=[1 2 3 4]

Transfer function:
3 s^3 + 4 s^2 + 5 s + 4
-----------------------
S^3 + 2 s^2 + 3 s + 4


A =
0 1 0
0 0 1
-4 -3 -2


B =
0
0
1

C =

-8 -4 -2

D =

3

You might also like