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

Lab Session 1

Title
To study the basics of MATLAB

Apparatus
MATLAB Software

Introduction
This lab aims to cover/revise basics of Matlab as well as basics of Modelling that you
have already studied in previous semesters.

1a: Basic Arithmetic operations and Loops:

1b: Arrays/Matrices:

A=[1 2 3];

B=[1 2 3;4 5 6;7 8 9];

Operations on Matrices

2: Plots and Subplots:

plot, subplot, title, xlabel, ylabel, grid, hold, subplot

3: Solving Polynomials:

s2  s  1  0

B=[1 1 1];

A=roots(B)

poly(A)

roots command computes the roots of polynomial whose coefficients are elements of
vector provided.

poly command gives polynomial out of roots computed by roots command.


4: Transfer Function:

SYS=tf(NUM,DEN)

tf command creates transfer function.

5: Response to common inputs:

step(SYS)

impulse(SYS)

lsim(SYS)

6: State Space:

tf2ss(sys)

ss2tf()

7: Series/Parallel:

Let the process represented by the transfer function G(s) be

We can use the “series” function to cascade two transfer functions G1(s) and G2(s),

>> numg=[1];
>> deng=[500 0 0];
>> sysg=tf(numg,deng);
>> numh=[1 1];
>> denh=[1 2];
>> sysh=tf(numh,denh);
>> sys=series(sysg,sysh)
>> sys=paralell(sysg,sysh)

Task
In next lab

You might also like