SlideShare a Scribd company logo
Introduction to  Matlab  By Abd El Kareem Ahmed
Contents MATLAB Environment Command window, Workspace, Path window, Editor window,and Figure window) Basic Functions:   clc, clear, save, load, who, whos … Variables in MATLAB Arrays   Control flow (for – end, while – end, if – else – elseif – end, switch  M-files Plotting Introduction to GUI Introduction to Image processing Toolbox
MATLAB Environment   Command window Use  Menus  as an alternative to typing some commands  Use of  Toolbar  for easy access to popular operations Status bar Command window Status of Caps, Num, and Scroll locks New M-file Open file Undo New Simulink Model Help Cut Paste Copy Workspace Browser Path Browser
MATLAB Environment   Workspace Open the selected matrix  Delete the selected matrix from the workspace Displays the total number of elements in the workspace and total size of them. Close the workspace browser  size of the matrix  Number of bytes in the matrix Name of the matrix Type of the matrix
MATLAB Environment   Workspace Name of the matrix  Current dimension of  the matrix:  User can change the dimensions of the matrix by simply type the dimensions he/she want  Current Cell  Current values:  User can change the values o the matrix’s element by editing in the cell.
MATLAB Environment   Path browser The current Directory  The directories in the path  The Files in the selected path.  Add a new path  Remove the selected path
MATLAB Environment   Editor window Current line number Automatic Indenting Automatic Color Highlighting to Distinguish Different Elements The toolbar Names of the opened files in the editor New file Save file Copy Print Set/Clear break point Step in Continue  List if functions in call stack  Open file Cut Paste Help Clear  all break points  Single step Quit debugging
MATLAB Environment   Figure window New figure Open an exciting figure  Save the current figure Print  Zoom the plot  Rotate the plot  Start / End the plot editor mode  Draw an arrow in the plot Type a text in the plot Draw a line in the plot
Basic Functions load save lookfor help whos who clear clc Function name Loading  saved workspace Saving  workspace Search for a word in  MATLAB files Show information about any function Show  workspace   in details Show  workspace Clear  workspace Clear the command window Function mean
Variables MATLAB   variables are  arrays Variable must be  one word myvariable accepted my variable   not accepted Variable length is up to  31 character Variables must  begin by a character MATLAB   variables are case sensitive There are preserved variable names:
Variables The number of output parameters nargout   The number of input parameters nargin Maximum real number = 10 308 × 1.7977 realmax Minimum real number = 10 -308 × 2.2251 realmin When the result = 0/0 NaN Very large value =  ∞  as the result of (1/0) inf Very small value eps Pi = 3.14 pi  Default function output ans
Arrays : review Vector Array : (1 × n), (m ×1) Matrix : (m × n) Identity array 5  4  0  7 0 5 7 1  4  4  5 12  8  9  15 1  0  0 0  1  0 0  0  1 5 3  4 0  0 (2×4) ->  (3×2) ->  (1×4) ->  (3×1) ->
Arrays : review Assume You have  A =  B= A+B= A’  = 2A =  = 1  3  0  2 5  4  0  7 0  1  4  3 7  4  9  8  1  4  4  5 12  8  9  15 2  6  0  4 10  8  0  14 5 3  4 0  0 2  7 ax+by cx+dy ex+fy (m×k)(k×n)=(m×n)  a b c d e f x y
Arrays : Marlab vision 2  3  5  9  1 0  3  6  4  5 1  10  8  6  4 M= M=[2 3 5 9 1 ; 0 3 6 4 5 ; 1 10 8 6 4]   M(1)    2 M(6)    10 M(3, 4)    6 M(3, :)    1 10 8 6 4 M(:, 2)    3 3 10 M(1, 2:4)    3 5 9 M(2, 1:2:5)    0 6 5 a=[1 4 6 8 9]  a=[1,4,6,8,9]  m=[18] a=3*6   m=[4] m=4
0  0  0 0  0  0 0  0  0 0  0  0 0  0  0 1  1  1 1  1  1 1  1  1 1  1  1 1  1  1 1  0  0 0  1  0 0  0  1 1  0  0 0  1  0 8  1  6 3  5  7 4  9  2 0.1389  0.6038  0.0153  0.9318 0.2028  0.2722  0.7468  0.4660   0.1987  0.1988  0.4451  0.4186 magic(3) =  magic logspace (0,4,5)= [1 10 100 1000 10000] logspace (1,2,3)= [10 31.6228 100] logspace linspace  ( 0,4,5 )=  [0 1 2 3 4]  linspace  ( 1,2,3 )=  [1 1.5 2] linspace rand ( 3,4) =  rand eye(3)=  eye(2,3)=  eye ones(3)=  ones(2,3)=  ones zeros(3)=  zeros(2,3)=  zeros Standard arrays
N= 1  0  3 4  7  5 9  2  8 1 7 8 9  2  8 4  7  5 1  0  3 3  0  1 5  7  4 8  2  9 3  5  8 0  7  2 1  4  9 -0.3866  -0.0504  0.1765 -0.1092  0.1597  -0.0588 0.4622  0.0168  -0.0588 1  4  9 0  7  2 3  5  8 find (N ==7 ) = 5  find (N == 10 ) = []  find rot90(N)=  fliplr ( N)= flipud ( N)=   min(N) =  [1  0  3] max(N) = [9  7  8] sum(N) = [14  9  16] rot90 fliplr flipud min max sum transpose ( ´  ) inv diag det length size transpose ( N)= diag(N)= det(N)=-119 length(N)=[3] size(N)=[3 3] Array functions
Relational and Logical Operators logical exclusive or xor logical not ~ not logical or | or logical and & and Logical Operators greater than or equal >= ge less than or equal  <= le greater than  > gt less than < lt not equal ~= ne equal = = eq Comment Symbol Operator name Relational Operators
Control Flow for – end   for  variable= expression statements end example: for i=1:10  for j=1:2:10 x(i) = i*2;   y=j end end
Control Flow while – end   x=0; while  (x<5) x=x+s; disp (x);  end
Control Flow if – else – elseif – end a=6; % a=7;  % a=10 ; if  (rem(a,3)==0) a=a*3; elseif  (rem(a,2)==0) a=a*2; else a=a*10; end disp  (a);
Control Flow switch – case – otherwise – end x=  input  (‘The value of x:’); units=  input  (“Enter the unit of x: (Please Enter the unit between ‘ ‘) ’); switch units case (‘inch’,’in’) y=x*2.54 ; case (‘feet’,’ft’) y=x*2.54*12 ; case (‘meter’,’m’) y=x*100 ; case (‘millimeter’,’mm’) y=x/10 ; otherwise disp  (‘Unknown unit’); end
Control Flow break for i=1:10 if (i>5) break ; else a=a*4.5; end end disp  (a);
M-files Scripts  :  Deal with the work space directly without inputs or outputs Functions:  Needs inputs and only the outputs are saved in the workspace. examples: function [output1,output2…]=function_name(input1,input2,…)   function  function_name(input1,input2,…)
M-files Function or script calling is done by typing the file name. The function file name must be the same as function name Function name must be one word Has a maximum of 31character size Starting by a character
M-files Assume a function:  function  [a,b,c]=my_function(x,y) is called as [b]=my_function(x,y,z); [a,b,c]=my_function(u); then  b = a value  x= u value
Math functions rem ceil floor round fix Approximation functions sph2cart deg2rad rad2deg base2dec pol2cart cart2pol cart2sph bin2dec hex2dec dec2base dec2bin dec2hex conversion functions tanh sinh cosh acot asec rem ceil floor real imag conj angle abs cos abs complex functions acsc sort cot min sec max csc exp atan log10 asin log acos power tan mean sin sqrt triangular   functions Basic functions
Exercise write a matlab program that sum a series begins by 2 and ends by 100 Use both for and while loops in separated m-files write a switch – case program such that: if  35>=S>20 display ‘ Hot Day’ if  20>=S>10 display ‘ Nice Day’ if 10>=S>=0 display ‘ Cold Day   ‘ otherwise display   ‘ Out of Range’ That  S is the sum of the array M, and M is: Random matrix of size  3×6  and has values between 0 and 2 A square matrix of size 3 and values between 1 and 9 A vector of equal elements =5 and size of 7 Identity matrix of size  10×10

More Related Content

What's hot (20)

PPSX
Introduction to MATLAB
Bhavesh Shah
 
PDF
MATLAB INTRODUCTION
Dr. Krishna Mohbey
 
PPTX
What is matlab
Shah Rukh Qureshi
 
PPTX
An Introduction to MATLAB for beginners
Murshida ck
 
PPT
Matlab Overviiew
Nazim Naeem
 
PDF
MATLAB Basics-Part1
Elaf A.Saeed
 
PPTX
Operators in java
yugandhar vadlamudi
 
PPTX
Introduction to matlab
VidhyaSenthil
 
DOCX
B61301007 matlab documentation
Manchireddy Reddy
 
PPT
Loops in matlab
TUOS-Sam
 
PPT
Introduction to matlab
Tarun Gehlot
 
PPT
Introduction to matlab
Mohan Raj
 
PDF
Matlab intro
Chaitanya Banoth
 
DOCX
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
PPT
Matlab introduction
Satish Gummadi
 
PPT
Introduction to matlab
BilawalBaloch1
 
PDF
INTRODUCTION TO ALGORITHMS Third Edition
PHI Learning Pvt. Ltd.
 
PDF
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
Rai University
 
PPTX
Basic matlab and matrix
Saidur Rahman
 
PPTX
C# Access modifiers
Prem Kumar Badri
 
Introduction to MATLAB
Bhavesh Shah
 
MATLAB INTRODUCTION
Dr. Krishna Mohbey
 
What is matlab
Shah Rukh Qureshi
 
An Introduction to MATLAB for beginners
Murshida ck
 
Matlab Overviiew
Nazim Naeem
 
MATLAB Basics-Part1
Elaf A.Saeed
 
Operators in java
yugandhar vadlamudi
 
Introduction to matlab
VidhyaSenthil
 
B61301007 matlab documentation
Manchireddy Reddy
 
Loops in matlab
TUOS-Sam
 
Introduction to matlab
Tarun Gehlot
 
Introduction to matlab
Mohan Raj
 
Matlab intro
Chaitanya Banoth
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
Matlab introduction
Satish Gummadi
 
Introduction to matlab
BilawalBaloch1
 
INTRODUCTION TO ALGORITHMS Third Edition
PHI Learning Pvt. Ltd.
 
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
Rai University
 
Basic matlab and matrix
Saidur Rahman
 
C# Access modifiers
Prem Kumar Badri
 

Similar to Learn Matlab (20)

PPT
Matlab Basic Tutorial
Muhammad Rizwan
 
PPT
matlab_tutorial.ppt
SudhirNayak43
 
PPT
matlab_tutorial.ppt
KrishnaChaitanya139768
 
PPT
matlab_tutorial.ppt
ManasaChevula1
 
PDF
ML-CheatSheet (1).pdf
KarroumAbdelmalek
 
PPT
matlab tutorial with separate function description and handson learning
vishalkumarpandey12
 
PPT
Matlab1
guest8ba004
 
PPTX
Intro to matlab
Norhan Mohamed
 
PPTX
Mat lab workshop
Vinay Kumar
 
PPT
Introduction of MatLab
Imran Nawaz
 
PPT
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
reddyprasad reddyvari
 
PDF
Matlab pt1
Austin Baird
 
PDF
Matlab lec1
Amba Research
 
PDF
Matlab for beginners, Introduction, signal processing
Dr. Manjunatha. P
 
PPT
gmrit-cse
Ayyarao T S L V
 
PDF
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
PDF
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
PPTX
intro2matlab-basic knowledge about Matlab.pptx
uf5221985
 
PPT
Introduction to MatLab programming
Damian T. Gordon
 
PDF
Matlab cheatsheet
lokeshkumer
 
Matlab Basic Tutorial
Muhammad Rizwan
 
matlab_tutorial.ppt
SudhirNayak43
 
matlab_tutorial.ppt
KrishnaChaitanya139768
 
matlab_tutorial.ppt
ManasaChevula1
 
ML-CheatSheet (1).pdf
KarroumAbdelmalek
 
matlab tutorial with separate function description and handson learning
vishalkumarpandey12
 
Matlab1
guest8ba004
 
Intro to matlab
Norhan Mohamed
 
Mat lab workshop
Vinay Kumar
 
Introduction of MatLab
Imran Nawaz
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
reddyprasad reddyvari
 
Matlab pt1
Austin Baird
 
Matlab lec1
Amba Research
 
Matlab for beginners, Introduction, signal processing
Dr. Manjunatha. P
 
gmrit-cse
Ayyarao T S L V
 
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
intro2matlab-basic knowledge about Matlab.pptx
uf5221985
 
Introduction to MatLab programming
Damian T. Gordon
 
Matlab cheatsheet
lokeshkumer
 
Ad

Recently uploaded (20)

PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Horarios de distribución de agua en julio
pegazohn1978
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Ad

Learn Matlab

  • 1. Introduction to Matlab By Abd El Kareem Ahmed
  • 2. Contents MATLAB Environment Command window, Workspace, Path window, Editor window,and Figure window) Basic Functions: clc, clear, save, load, who, whos … Variables in MATLAB Arrays Control flow (for – end, while – end, if – else – elseif – end, switch M-files Plotting Introduction to GUI Introduction to Image processing Toolbox
  • 3. MATLAB Environment Command window Use Menus as an alternative to typing some commands Use of Toolbar for easy access to popular operations Status bar Command window Status of Caps, Num, and Scroll locks New M-file Open file Undo New Simulink Model Help Cut Paste Copy Workspace Browser Path Browser
  • 4. MATLAB Environment Workspace Open the selected matrix Delete the selected matrix from the workspace Displays the total number of elements in the workspace and total size of them. Close the workspace browser size of the matrix Number of bytes in the matrix Name of the matrix Type of the matrix
  • 5. MATLAB Environment Workspace Name of the matrix Current dimension of the matrix: User can change the dimensions of the matrix by simply type the dimensions he/she want Current Cell Current values: User can change the values o the matrix’s element by editing in the cell.
  • 6. MATLAB Environment Path browser The current Directory The directories in the path The Files in the selected path. Add a new path Remove the selected path
  • 7. MATLAB Environment Editor window Current line number Automatic Indenting Automatic Color Highlighting to Distinguish Different Elements The toolbar Names of the opened files in the editor New file Save file Copy Print Set/Clear break point Step in Continue List if functions in call stack Open file Cut Paste Help Clear all break points Single step Quit debugging
  • 8. MATLAB Environment Figure window New figure Open an exciting figure Save the current figure Print Zoom the plot Rotate the plot Start / End the plot editor mode Draw an arrow in the plot Type a text in the plot Draw a line in the plot
  • 9. Basic Functions load save lookfor help whos who clear clc Function name Loading saved workspace Saving workspace Search for a word in MATLAB files Show information about any function Show workspace in details Show workspace Clear workspace Clear the command window Function mean
  • 10. Variables MATLAB variables are arrays Variable must be one word myvariable accepted my variable not accepted Variable length is up to 31 character Variables must begin by a character MATLAB variables are case sensitive There are preserved variable names:
  • 11. Variables The number of output parameters nargout The number of input parameters nargin Maximum real number = 10 308 × 1.7977 realmax Minimum real number = 10 -308 × 2.2251 realmin When the result = 0/0 NaN Very large value = ∞ as the result of (1/0) inf Very small value eps Pi = 3.14 pi Default function output ans
  • 12. Arrays : review Vector Array : (1 × n), (m ×1) Matrix : (m × n) Identity array 5 4 0 7 0 5 7 1 4 4 5 12 8 9 15 1 0 0 0 1 0 0 0 1 5 3 4 0 0 (2×4) -> (3×2) -> (1×4) -> (3×1) ->
  • 13. Arrays : review Assume You have A = B= A+B= A’ = 2A = = 1 3 0 2 5 4 0 7 0 1 4 3 7 4 9 8 1 4 4 5 12 8 9 15 2 6 0 4 10 8 0 14 5 3 4 0 0 2 7 ax+by cx+dy ex+fy (m×k)(k×n)=(m×n) a b c d e f x y
  • 14. Arrays : Marlab vision 2 3 5 9 1 0 3 6 4 5 1 10 8 6 4 M= M=[2 3 5 9 1 ; 0 3 6 4 5 ; 1 10 8 6 4] M(1)  2 M(6)  10 M(3, 4)  6 M(3, :)  1 10 8 6 4 M(:, 2)  3 3 10 M(1, 2:4)  3 5 9 M(2, 1:2:5)  0 6 5 a=[1 4 6 8 9] a=[1,4,6,8,9] m=[18] a=3*6 m=[4] m=4
  • 15. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 1 0 8 1 6 3 5 7 4 9 2 0.1389 0.6038 0.0153 0.9318 0.2028 0.2722 0.7468 0.4660 0.1987 0.1988 0.4451 0.4186 magic(3) = magic logspace (0,4,5)= [1 10 100 1000 10000] logspace (1,2,3)= [10 31.6228 100] logspace linspace ( 0,4,5 )= [0 1 2 3 4] linspace ( 1,2,3 )= [1 1.5 2] linspace rand ( 3,4) = rand eye(3)= eye(2,3)= eye ones(3)= ones(2,3)= ones zeros(3)= zeros(2,3)= zeros Standard arrays
  • 16. N= 1 0 3 4 7 5 9 2 8 1 7 8 9 2 8 4 7 5 1 0 3 3 0 1 5 7 4 8 2 9 3 5 8 0 7 2 1 4 9 -0.3866 -0.0504 0.1765 -0.1092 0.1597 -0.0588 0.4622 0.0168 -0.0588 1 4 9 0 7 2 3 5 8 find (N ==7 ) = 5 find (N == 10 ) = [] find rot90(N)= fliplr ( N)= flipud ( N)= min(N) = [1 0 3] max(N) = [9 7 8] sum(N) = [14 9 16] rot90 fliplr flipud min max sum transpose ( ´ ) inv diag det length size transpose ( N)= diag(N)= det(N)=-119 length(N)=[3] size(N)=[3 3] Array functions
  • 17. Relational and Logical Operators logical exclusive or xor logical not ~ not logical or | or logical and & and Logical Operators greater than or equal >= ge less than or equal <= le greater than > gt less than < lt not equal ~= ne equal = = eq Comment Symbol Operator name Relational Operators
  • 18. Control Flow for – end for variable= expression statements end example: for i=1:10 for j=1:2:10 x(i) = i*2; y=j end end
  • 19. Control Flow while – end x=0; while (x<5) x=x+s; disp (x); end
  • 20. Control Flow if – else – elseif – end a=6; % a=7; % a=10 ; if (rem(a,3)==0) a=a*3; elseif (rem(a,2)==0) a=a*2; else a=a*10; end disp (a);
  • 21. Control Flow switch – case – otherwise – end x= input (‘The value of x:’); units= input (“Enter the unit of x: (Please Enter the unit between ‘ ‘) ’); switch units case (‘inch’,’in’) y=x*2.54 ; case (‘feet’,’ft’) y=x*2.54*12 ; case (‘meter’,’m’) y=x*100 ; case (‘millimeter’,’mm’) y=x/10 ; otherwise disp (‘Unknown unit’); end
  • 22. Control Flow break for i=1:10 if (i>5) break ; else a=a*4.5; end end disp (a);
  • 23. M-files Scripts : Deal with the work space directly without inputs or outputs Functions: Needs inputs and only the outputs are saved in the workspace. examples: function [output1,output2…]=function_name(input1,input2,…) function function_name(input1,input2,…)
  • 24. M-files Function or script calling is done by typing the file name. The function file name must be the same as function name Function name must be one word Has a maximum of 31character size Starting by a character
  • 25. M-files Assume a function: function [a,b,c]=my_function(x,y) is called as [b]=my_function(x,y,z); [a,b,c]=my_function(u); then b = a value x= u value
  • 26. Math functions rem ceil floor round fix Approximation functions sph2cart deg2rad rad2deg base2dec pol2cart cart2pol cart2sph bin2dec hex2dec dec2base dec2bin dec2hex conversion functions tanh sinh cosh acot asec rem ceil floor real imag conj angle abs cos abs complex functions acsc sort cot min sec max csc exp atan log10 asin log acos power tan mean sin sqrt triangular functions Basic functions
  • 27. Exercise write a matlab program that sum a series begins by 2 and ends by 100 Use both for and while loops in separated m-files write a switch – case program such that: if 35>=S>20 display ‘ Hot Day’ if 20>=S>10 display ‘ Nice Day’ if 10>=S>=0 display ‘ Cold Day ‘ otherwise display ‘ Out of Range’ That S is the sum of the array M, and M is: Random matrix of size 3×6 and has values between 0 and 2 A square matrix of size 3 and values between 1 and 9 A vector of equal elements =5 and size of 7 Identity matrix of size 10×10