1 / 5

Basic tools in Matlab

Basic tools in Matlab. A review of some of the basic tools for controls calculations . Matlab variable entry. Set variables a=3 b=[3,4,7] row vector c=[3; 4; 7] column vector d=[1,2;3,4] matrix Show variables who whos Clear variables clear clear x Set iterated list

liliha
Download Presentation

Basic tools in Matlab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BAE 3023 Basic tools in Matlab A review of some of the basic tools for controls calculations

  2. Matlab variable entry BAE 3023 • Set variables a=3 b=[3,4,7] row vector c=[3; 4; 7] column vector d=[1,2;3,4] matrix • Show variables who whos • Clear variables clear clear x • Set iterated list e=1:0.2:10 (start : increment : end) • Get Help help help lsim “for help on lsim” • use windows help function

  3. Matlab calculations BAE 3023 • Matlab offers basic mathematical calculation tools that may be used for calculations in control systems. • Summary: • Entry of polynomials as a row vector • For the polynomial: den=[1,1,4] Num=[1] • Roots of a polynomial • For the polynomial: den=[1,1,4] roots(den) • Definition of a transfer function • For the above variables num,den s = tf(num,den) • Calculations involving complex numbers a = 1.1 + 2.7i r = a^2 + a + 4

  4. Matlab simulation BAE 3023 • Simulation of response of a system described by transfer functions • Step input • For the polynomial: den=[1,1,4] num=[1] s = tf(num,den) step(s) Plot will result • Impulse input (as above except:) impulse(s) • General function input (assume the above polynomial) t = 0 : 0.1 : 100; “sets time vector with start : increment : end” u = cos(t); “sets the input function to u for the given time vector” lsim(s,u,t) “outputs a plot of the response over the set time” • u may be any function. Matlab provides generic functions ie. sin, cos, square, triangle, etc.

  5. Matlab plotting BAE 3023 • Simple plotting • Simple x/y plot x=0:1:20 y=sin(x) plot(x,y) • Set line /point type plot(x,y,’c+’) “cyan “+” points “ plot(x,y,’r+’,x,y,’b-’) “red points and blue line” • Set Titles and labels Labels xlabel(‘X-axis’) ylabel(‘Y-Axis’) title(‘Title’)

More Related