Download presentation
Presentation is loading. Please wait.
Published byMelina Garrison Modified over 9 years ago
1
Matlab Tutorial Iman Moazzen First Session – September 11, 2013
2
Matlab (Matrix Laboratory) It allows you to solve many technical computing problems, especially those with vector or matrix formulation.
4
Identifiers Variables or function names Remarks: 1- It can include letters, digits, underline 2- The first character must be a letter e.g.: 3iman iman@3 iman613 iman$$ Iman613 iman_3 pi i j
5
Matlab (Matrix laboratory) Single value a=1 Vector row vector: a=[1 2,3] column vector a=[1;2;3] Matrix a=[1 2 3;4 5 6;7 8 9]
6
a=[1 4 6 7; 5 2 0 9; 8 8 3 2; 7 6 5 1] a(1,3) 6 a(1,:) [1 4 6 7] a(:,2) [4;2;8;6] a(1:3,2:3) [4 6;2 0;8 3] 2D index: a(row,column) 1D index: a(index) start:step:end e.g: 1:2:5 [1 3 5]
7
1D index a(1,2) a(6) 2 a(1:2:end) [1 8 4 8 6 3 7 2]
8
Special Matrix eye eye(3,3) ones ones(1,3) [1 1 1] zeros zeros(1,4) [0 0 0 0] rand rand(1,2) [0.37 0.86] linspace linspace(1,3,5) [1 1.5 2 2.5 3]
9
Basic Fucntion + - * / ^ abs angle imag real conj round floor ceil mod min max sum prod cart2pol pol2cart syms subs exp log log10 log2 sqrt sin cos tan asin acos atan help
10
Use M.File to create Matlab code intead of command window file new M.file
11
Conditional Statements if-elesif-else while switch
12
Function function [out1,out2,…]=functionname(input1,input2,…) Note: function can not be run directly, you need to call it.
13
Graphing plot - color - style - Label
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.