Module1 - MECH431L:ControlSystemsLaboratory...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
MECH 431L: Control Systems Laboratory Module I: Introduction to MATLAB Objectives: Learning the MATLAB user interface Matrix manipulation and arithmetic operators Some basic MATLAB functions Polynomials and Curve fitting Generating plots Useful Functions Command Description doc Opens the MATLAB help window (doc <function> to search for a specific function help Displays MATLAB help in the command window (help <function> to get help on a specific function) clc Clears the workspace view clear Clears a variable from the workspace (e.g. clear X , clear all) figure Create a new (empty) figure window hold on Holds the current plot inside the figure window hold off Turns off hold feature for the current figure inv(A) Finds the inverse of matrix A roots(B) Finds the roots of the polynomial of coefficients P polyfit(x,y,n) Finds a polynomial fit of order n for set of points x and y polyval(P,x) Evaluates polynomial P at a set of values x length(x) Returns the largest dimension of matrix x size(x) Returns the dimensions of matrix x xlabel(‘label1’) Adds the text ‘label1’ under the x axis of the plot ylabel(‘label2’) Adds the text ‘label2’ beside the y axis of the plot axis([x1 x2 y1 y2]) Scales the axes of the plot Title(‘text’) Assigns a title to the current figure num2str(x) Converts the matrix representation of numbers in x into a string representation str2num(‘1’) Converts the character representation to a matrix representation of numbers ones(x,y) Creates a matrix of size x by y with values of 1 for every element zeros(x,y) Similar to ones, but the values are 0.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Matrices in MATLAB: Creating Matrices [1 2 3 4] % Create a row matrix of 4 numbers x = [1 2 3 4] % Create a row matrix of 4 numbers and store in x y = [1,2,3,4]; % Create a row matrix of 4 numbers while suppressing the output z = [1;2;3;4] % Create a column matrix of 4 numbers c = [ 'a' 'b' 'c'
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/07/2011 for the course MECH 431L taught by Professor Danielasmar during the Spring '09 term at American University of Beirut.

Page1 / 6

Module1 - MECH431L:ControlSystemsLaboratory...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online