SlideShare a Scribd company logo
Introduction to Matlab
Anmar K . Ibrahim
an76mar16@yahoo.com
Introduction to Matlab Sumitha Balasuriya 2
Matlab
• Stands for MATrix LABoratory
• Interpreted language
• Scientific programming environment
• Very good tool for the manipulation of matrices
• Great visualisation capabilities
• Loads of built-in functions
• Easy to learn and simple to use
Introduction to Matlab Sumitha Balasuriya 3
Matlab Desktop
Command
Window
Workspace /
Current Directory
Command
History
Explore the Matlab Desktop
Introduction to Matlab Sumitha Balasuriya 4
Variables
• Don’t have to declare type
• Don’t even have to initialise
• Just assign in command window
>>
>> a=12; % variable a is assigned 12
Matlab
prompt
assign
operator
suppress
command
output
comment
operator
Try the same line without the
semicolon and comments
Introduction to Matlab Sumitha Balasuriya 5
Variables (continued …)
• View variable contents by simply typing the
variable name at the command prompt
>> a
a =
12
>>
>> a*2
a =
24
>>
Introduction to Matlab Sumitha Balasuriya 6
Workspace
• The workspace is Matlab’s memory
• Can manipulate variables stored in the workspace
>> b=10;
>> c=a+b
c =
22
>>
Introduction to Matlab Sumitha Balasuriya 7
Workspace (continued …)
• Display contents of workspace
>> whos
Name Size Bytes Class
a 1x1 8 double array
b 1x1 8 double array
c 1x1 8 double array
Grand total is 3 elements using 24 bytes
>>
• Delete variable(s) from workspace
>> clear a b; % delete a and b from workspace
>> whos
>> clear all; % delete all variables from workspace
>> whos
Introduction to Matlab Sumitha Balasuriya 8
Matlab help commands
• help
>> help whos % displays documentation for the function whos
>> lookfor convert % displays functions with convert in the first help line
• Start Matlab help documentation
>> helpdesk
Introduction to Matlab Sumitha Balasuriya 9
Matrices
• Don’t need to initialise type, or dimensions
>>A = [3 2 1; 5 1 0; 2 1 7]
A =
3 2 1
5 1 0
2 1 7
>>
square brackets to define matrices
semicolon for next row in matrix
Introduction to Matlab Sumitha Balasuriya 10
Manipulating Matrices
• Access elements of a matrix
>>A(1,2)
ans=
2
• Remember Matrix(row,column)
• Naming convention Matrix variables start
with a capital letter while vectors or scalar
variables start with a simple letter
A =
3 2 1
5 1 0
2 1 7
indices of matrix element(s)
Introduction to Matlab Sumitha Balasuriya 11
The : operator
• VERY important operator in Matlab
• Means ‘to’
>> 1:10
ans =
1 2 3 4 5 6 7 8 9 10
>> 1:2:10
ans =
1 3 5 7 9
Try the following
>> x=0:pi/12:2*pi;
>> y=sin(x)
Introduction to Matlab Sumitha Balasuriya 12
The : operator and matrices
>>A(3,2:3)
ans =
1 7
>>A(:,2)
ans =
2
1
1
A =
3 2 1
5 1 0
2 1 7
What’ll happen if you type A(:,:) ?
Introduction to Matlab Sumitha Balasuriya 13
Manipulating Matrices
>> A ' % transpose
>> B*A % matrix multiplication
>> B.*A% element by element multiplication
>> B/A % matrix division
>> B./A % element by element division
>> [B A] % Join matrices (horizontally)
>> [B; A] % Join matrices (vertically)
A =
3 2 1
5 1 0
2 1 7
B =
1 3 1
4 9 5
2 7 2
Create matrices A and B and try out the the matrix operators in this slide
Enter matrix B
into the Matlab
workspace
Introduction to Matlab Sumitha Balasuriya 14
Scripts
• Matlab editor
• Use scripts to execute a series of Matlab
commands
Matlab
Desktop
Press to create
new m-file in the
matlab editor
Introduction to Matlab Sumitha Balasuriya 15
Scripts(continued)
• Scripts will manipulate and
store variables and matrices
in the Matlab Workspace
(memory).
• They can be called from the
Matlab command line by
typing the (case sensitive!)
filename of the script file.
>> myscript
• Scripts can be opened in the
editor by the following
>> open myscript
Highlight a few lines of your
script by left- clicking and
dragging the mouse over the
lines. Right-click the
highlighted lines and select
Evaluate Selection.
Will be slightly
different in Linux
Introduction to Matlab Sumitha Balasuriya 16
Functions
• Programming in Matlab.
• Users can write functions which can be called from the command line.
• Functions can accept input variable(s)/matrice(s) and will output
variable(s)/matrice(s).
• Functions will not manipulate variable(s)/matrice(s) in the Matlab
Workspace.
• In Matlab functions closely resemble scripts and can be written in the
Matlab editor. Matlab functions have the function keyword.
• Remember that the filename of a function will be its calling function name.
• Don’t overload any built-in functions by using the same filename for your
functions or scripts!
• Functions can be opened for editing using the open command. Many built-
in Matlab functions can also be viewed using this command.
Introduction to Matlab Sumitha Balasuriya 17
>> I=iterate(5)
I =
1 4 9 16 25
Functions (continued)
output
input
function name
for statement block
function keyword
help lines for function
Access the comments of
your Matlab functions
>> help iterate Make sure you save changes to the
m-file before you call the function!
Introduction to Matlab Sumitha Balasuriya 18
>> [i j]=sort2(2,4)
i =
4
j =
2
>>
Functions (continued)
Functions can have many
outputs contained in a matrix
Remember to use the
Matlab help command for
syntax
>> help if
if statement
block
Introduction to Matlab Sumitha Balasuriya 19
More flow control
Method is linear
>>
i =
4
i =
16
i =
256
While statement block Switch statement block
Without ; to
print output
Introduction to Matlab Sumitha Balasuriya 20
Debugging
• Set breakpoints to stop the execution of code
>> [i j]=sort2(2,4)
K>>
K>> whos
Name Size Bytes Class
a 1x1 8 double array
b 1x1 8 double array
Grand total is 2 elements using 16 bytes
K>> a
a =
2
K>> return
i =
4
j =
2
Click mouse on the left
of the line of code to
create a breakpoint
local function
workspace
exit debug
mode
Debug menus
Introduction to Matlab Sumitha Balasuriya 21
Visualisation - plotting data
>> figure % create new figure
>> t=0:pi/12:8*pi;
>> y=cos(t);
>> plot(t,y,‘b.-')
Investigate the function
>> y=A*cos(w*t+phi);
for different values of phi (eg: 0, pi/4, pi/3,
pi/2), w (eg: 1, 2, 3, 4) and A (eg: 1, 0.5, 2). Use
the hold on Matlab command to display your
plots in the same figure. Remember to type
hold off to go back to normal plotting mode.
Try using different plot styles (help plot)
A = amplitude
phi = phase
w = angular frequency = 2*pi*frequency
Plot style
Introduction to Matlab Sumitha Balasuriya 22
Image Processing using Matlab
Next week …
Introduction to Matlab Sumitha Balasuriya 23
Useful operators and built-in functions
< ¦ save !
> rand load guide
~= zeros … get
== min ' ' set
>= max { }
<= repmat try
& axis catch
Remember to use the Matlab help command if you get stuck
string
cell
error handling
Operating
system
command
Graphical
user interface
Continue in next line
Introduction to Matlab Sumitha Balasuriya 24
Tutorial 1
• Login to your workstation, start Matlab and create a working directory
1) Login to Linux using your username/password
2) Open a terminal session by right clicking the mouse on the screen and selecting New Terminal
3) Type the following in the terminal session (do not type the prompt sign > )
> matlab
> mkdir work
4) Type the following in Matlab (do not type the prompt sign >> )
>> cd work
• Explore Matlab! Use the help matlab command to understand the built-in Matlab functions
• Type the code in this handout in Matlab and investigate the results.
• Write a Matlab function fibonacci.m to generate the Fibonacci series. This is generated by starting with zero and one and adding the last two numbers of the
sequence to generate the next number in the series. Fibonacci series:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ...
• Create an graph of the Fibonacci series using the built-in plot Matlab function. Your graph should resemble figure 1 which contains a plot of the first 20
numbers in the sequence.
• Plot the Fibonacci series in polar coordinates using the built-in Matlab polar function. Eccentricity (rho) should be the Fibonacci number and angle (theta)
should vary with the Fibonacci number’s order in the sequence. Your plot should resemble figure 2 which is a polar plot of the first 10 numbers of the series.
• Exit Matlab by typing quit and logout of Linux.
>> quit
Figure 1
Figure 2

More Related Content

PPT
Matlab Tutorial.ppt
PPTX
Raushan's MATLB PPT..pptx
PDF
L_Matlab-1_DRS_OE1100 (2).pdf matlab matlab
PPTX
Introduction to scientific computing with matlab.pptx
PDF
MATLAB INTRODUCTION
PDF
An Introduction to MATLAB with Worked Examples
PPTX
From zero to MATLAB hero: Mastering the basics and beyond
DOC
Matlab tut2
Matlab Tutorial.ppt
Raushan's MATLB PPT..pptx
L_Matlab-1_DRS_OE1100 (2).pdf matlab matlab
Introduction to scientific computing with matlab.pptx
MATLAB INTRODUCTION
An Introduction to MATLAB with Worked Examples
From zero to MATLAB hero: Mastering the basics and beyond
Matlab tut2

Similar to Introduction_to_Matlabbanmar k ibrahim a (20)

PDF
MATLAB Programming
PDF
Malab tutorial
PDF
Lecture 01 variables scripts and operations
PPTX
Introduction to matlab lecture 1 of 4
PDF
Introduction to matlab
PDF
Introduction to matlab
PPT
matlab_tutorial.ppt
PPT
matlab_tutorial.ppt
PPT
matlab_tutorial.ppt
DOC
Matlab summary
DOCX
Introduction to matlab
PPTX
intro2matlab-basic knowledge about Matlab.pptx
PDF
Matlab guide
PDF
Introduction to Matlab.pdf
PPT
Matlab practical and lab session
PPSX
matlab-130408153714-phpapp02_lab123.ppsx
PPSX
Matlab basic and image
PPT
Matlab anilkumar
PPTX
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
PPT
INTRODUCTION TO MATLAB for PG students.ppt
MATLAB Programming
Malab tutorial
Lecture 01 variables scripts and operations
Introduction to matlab lecture 1 of 4
Introduction to matlab
Introduction to matlab
matlab_tutorial.ppt
matlab_tutorial.ppt
matlab_tutorial.ppt
Matlab summary
Introduction to matlab
intro2matlab-basic knowledge about Matlab.pptx
Matlab guide
Introduction to Matlab.pdf
Matlab practical and lab session
matlab-130408153714-phpapp02_lab123.ppsx
Matlab basic and image
Matlab anilkumar
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
INTRODUCTION TO MATLAB for PG students.ppt
Ad

More from naghamsalimmohammed (20)

PPSX
11 zakaria ai with energy newenergy.ppsx
PPT
d983d98ad981-d8aad983d988d986-d8a7d984d8a8d988d8a7d8a8d8a7d8aa-d985d986d8b7d9...
PPTX
AI with ner and renewableenergies n a.pptx
PPT
Chapter10-OS7el real time presentati.ppt
PPT
Operating-System-10 for ph.d teachi.ppt
PPT
Multiprocessor Real-Time Sched_uling.ppt
PPT
Lec07 multiprocessor schaduling chap.ppt
PPT
Chap10 real time for multiprocessor7.ppt
PPT
10-MultiprocessorScheduling chapter8.ppt
PPT
mutiprocessor systems chapter8 ph.d .ppt
PPT
matlab_tutorial for student in the first
PPTX
WO9ejqiILZzj8X9ukgJcLZEOytsecbibi1qSR6Bz (1).pptx
PPTX
MKmsUggtqlS5mRDRLo3FlTeNcmPzNIVCjpzVVkaN (1).pptx
PPTX
oQyvgYTNyhAJVuO8BoLY0enJahENMxFkfNT8paTS (1).pptx
PPTX
TSF5yTmKkTPQaknkEYP9X6WSyTsCrMNzUpijtAkK (1).pptx
PPTX
KV26unCxavbG0CVZUWraVNg1uPCF5dF05pWJjAvt (2).pptx
PPTX
H2vg9XMPlt5mQXMHQKy2LLkQBlcLL5MW101LhYpX (1).pptx
PPTX
AEl5jGXj60URITII3M0VZOgr0xufAxaWRDQhy4J4 (2).pptx
PPTX
3WcjHN3YS2okZOUBUeaiYybyJfk5Risw5717oEeO (1)(1).pptx
PPTX
24idjaxYc0jbbc5OtD33gM2n4efPnQ1OiDAUIGbF.pptx
11 zakaria ai with energy newenergy.ppsx
d983d98ad981-d8aad983d988d986-d8a7d984d8a8d988d8a7d8a8d8a7d8aa-d985d986d8b7d9...
AI with ner and renewableenergies n a.pptx
Chapter10-OS7el real time presentati.ppt
Operating-System-10 for ph.d teachi.ppt
Multiprocessor Real-Time Sched_uling.ppt
Lec07 multiprocessor schaduling chap.ppt
Chap10 real time for multiprocessor7.ppt
10-MultiprocessorScheduling chapter8.ppt
mutiprocessor systems chapter8 ph.d .ppt
matlab_tutorial for student in the first
WO9ejqiILZzj8X9ukgJcLZEOytsecbibi1qSR6Bz (1).pptx
MKmsUggtqlS5mRDRLo3FlTeNcmPzNIVCjpzVVkaN (1).pptx
oQyvgYTNyhAJVuO8BoLY0enJahENMxFkfNT8paTS (1).pptx
TSF5yTmKkTPQaknkEYP9X6WSyTsCrMNzUpijtAkK (1).pptx
KV26unCxavbG0CVZUWraVNg1uPCF5dF05pWJjAvt (2).pptx
H2vg9XMPlt5mQXMHQKy2LLkQBlcLL5MW101LhYpX (1).pptx
AEl5jGXj60URITII3M0VZOgr0xufAxaWRDQhy4J4 (2).pptx
3WcjHN3YS2okZOUBUeaiYybyJfk5Risw5717oEeO (1)(1).pptx
24idjaxYc0jbbc5OtD33gM2n4efPnQ1OiDAUIGbF.pptx
Ad

Recently uploaded (20)

PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
RMMM.pdf make it easy to upload and study
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Complications of Minimal Access Surgery at WLH
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Anesthesia in Laparoscopic Surgery in India
RMMM.pdf make it easy to upload and study
O7-L3 Supply Chain Operations - ICLT Program
01-Introduction-to-Information-Management.pdf
Cell Types and Its function , kingdom of life
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPH.pptx obstetrics and gynecology in nursing
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Basic Mud Logging Guide for educational purpose
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Complications of Minimal Access Surgery at WLH

Introduction_to_Matlabbanmar k ibrahim a

  • 1. Introduction to Matlab Anmar K . Ibrahim an76mar16@yahoo.com
  • 2. Introduction to Matlab Sumitha Balasuriya 2 Matlab • Stands for MATrix LABoratory • Interpreted language • Scientific programming environment • Very good tool for the manipulation of matrices • Great visualisation capabilities • Loads of built-in functions • Easy to learn and simple to use
  • 3. Introduction to Matlab Sumitha Balasuriya 3 Matlab Desktop Command Window Workspace / Current Directory Command History Explore the Matlab Desktop
  • 4. Introduction to Matlab Sumitha Balasuriya 4 Variables • Don’t have to declare type • Don’t even have to initialise • Just assign in command window >> >> a=12; % variable a is assigned 12 Matlab prompt assign operator suppress command output comment operator Try the same line without the semicolon and comments
  • 5. Introduction to Matlab Sumitha Balasuriya 5 Variables (continued …) • View variable contents by simply typing the variable name at the command prompt >> a a = 12 >> >> a*2 a = 24 >>
  • 6. Introduction to Matlab Sumitha Balasuriya 6 Workspace • The workspace is Matlab’s memory • Can manipulate variables stored in the workspace >> b=10; >> c=a+b c = 22 >>
  • 7. Introduction to Matlab Sumitha Balasuriya 7 Workspace (continued …) • Display contents of workspace >> whos Name Size Bytes Class a 1x1 8 double array b 1x1 8 double array c 1x1 8 double array Grand total is 3 elements using 24 bytes >> • Delete variable(s) from workspace >> clear a b; % delete a and b from workspace >> whos >> clear all; % delete all variables from workspace >> whos
  • 8. Introduction to Matlab Sumitha Balasuriya 8 Matlab help commands • help >> help whos % displays documentation for the function whos >> lookfor convert % displays functions with convert in the first help line • Start Matlab help documentation >> helpdesk
  • 9. Introduction to Matlab Sumitha Balasuriya 9 Matrices • Don’t need to initialise type, or dimensions >>A = [3 2 1; 5 1 0; 2 1 7] A = 3 2 1 5 1 0 2 1 7 >> square brackets to define matrices semicolon for next row in matrix
  • 10. Introduction to Matlab Sumitha Balasuriya 10 Manipulating Matrices • Access elements of a matrix >>A(1,2) ans= 2 • Remember Matrix(row,column) • Naming convention Matrix variables start with a capital letter while vectors or scalar variables start with a simple letter A = 3 2 1 5 1 0 2 1 7 indices of matrix element(s)
  • 11. Introduction to Matlab Sumitha Balasuriya 11 The : operator • VERY important operator in Matlab • Means ‘to’ >> 1:10 ans = 1 2 3 4 5 6 7 8 9 10 >> 1:2:10 ans = 1 3 5 7 9 Try the following >> x=0:pi/12:2*pi; >> y=sin(x)
  • 12. Introduction to Matlab Sumitha Balasuriya 12 The : operator and matrices >>A(3,2:3) ans = 1 7 >>A(:,2) ans = 2 1 1 A = 3 2 1 5 1 0 2 1 7 What’ll happen if you type A(:,:) ?
  • 13. Introduction to Matlab Sumitha Balasuriya 13 Manipulating Matrices >> A ' % transpose >> B*A % matrix multiplication >> B.*A% element by element multiplication >> B/A % matrix division >> B./A % element by element division >> [B A] % Join matrices (horizontally) >> [B; A] % Join matrices (vertically) A = 3 2 1 5 1 0 2 1 7 B = 1 3 1 4 9 5 2 7 2 Create matrices A and B and try out the the matrix operators in this slide Enter matrix B into the Matlab workspace
  • 14. Introduction to Matlab Sumitha Balasuriya 14 Scripts • Matlab editor • Use scripts to execute a series of Matlab commands Matlab Desktop Press to create new m-file in the matlab editor
  • 15. Introduction to Matlab Sumitha Balasuriya 15 Scripts(continued) • Scripts will manipulate and store variables and matrices in the Matlab Workspace (memory). • They can be called from the Matlab command line by typing the (case sensitive!) filename of the script file. >> myscript • Scripts can be opened in the editor by the following >> open myscript Highlight a few lines of your script by left- clicking and dragging the mouse over the lines. Right-click the highlighted lines and select Evaluate Selection. Will be slightly different in Linux
  • 16. Introduction to Matlab Sumitha Balasuriya 16 Functions • Programming in Matlab. • Users can write functions which can be called from the command line. • Functions can accept input variable(s)/matrice(s) and will output variable(s)/matrice(s). • Functions will not manipulate variable(s)/matrice(s) in the Matlab Workspace. • In Matlab functions closely resemble scripts and can be written in the Matlab editor. Matlab functions have the function keyword. • Remember that the filename of a function will be its calling function name. • Don’t overload any built-in functions by using the same filename for your functions or scripts! • Functions can be opened for editing using the open command. Many built- in Matlab functions can also be viewed using this command.
  • 17. Introduction to Matlab Sumitha Balasuriya 17 >> I=iterate(5) I = 1 4 9 16 25 Functions (continued) output input function name for statement block function keyword help lines for function Access the comments of your Matlab functions >> help iterate Make sure you save changes to the m-file before you call the function!
  • 18. Introduction to Matlab Sumitha Balasuriya 18 >> [i j]=sort2(2,4) i = 4 j = 2 >> Functions (continued) Functions can have many outputs contained in a matrix Remember to use the Matlab help command for syntax >> help if if statement block
  • 19. Introduction to Matlab Sumitha Balasuriya 19 More flow control Method is linear >> i = 4 i = 16 i = 256 While statement block Switch statement block Without ; to print output
  • 20. Introduction to Matlab Sumitha Balasuriya 20 Debugging • Set breakpoints to stop the execution of code >> [i j]=sort2(2,4) K>> K>> whos Name Size Bytes Class a 1x1 8 double array b 1x1 8 double array Grand total is 2 elements using 16 bytes K>> a a = 2 K>> return i = 4 j = 2 Click mouse on the left of the line of code to create a breakpoint local function workspace exit debug mode Debug menus
  • 21. Introduction to Matlab Sumitha Balasuriya 21 Visualisation - plotting data >> figure % create new figure >> t=0:pi/12:8*pi; >> y=cos(t); >> plot(t,y,‘b.-') Investigate the function >> y=A*cos(w*t+phi); for different values of phi (eg: 0, pi/4, pi/3, pi/2), w (eg: 1, 2, 3, 4) and A (eg: 1, 0.5, 2). Use the hold on Matlab command to display your plots in the same figure. Remember to type hold off to go back to normal plotting mode. Try using different plot styles (help plot) A = amplitude phi = phase w = angular frequency = 2*pi*frequency Plot style
  • 22. Introduction to Matlab Sumitha Balasuriya 22 Image Processing using Matlab Next week …
  • 23. Introduction to Matlab Sumitha Balasuriya 23 Useful operators and built-in functions < ¦ save ! > rand load guide ~= zeros … get == min ' ' set >= max { } <= repmat try & axis catch Remember to use the Matlab help command if you get stuck string cell error handling Operating system command Graphical user interface Continue in next line
  • 24. Introduction to Matlab Sumitha Balasuriya 24 Tutorial 1 • Login to your workstation, start Matlab and create a working directory 1) Login to Linux using your username/password 2) Open a terminal session by right clicking the mouse on the screen and selecting New Terminal 3) Type the following in the terminal session (do not type the prompt sign > ) > matlab > mkdir work 4) Type the following in Matlab (do not type the prompt sign >> ) >> cd work • Explore Matlab! Use the help matlab command to understand the built-in Matlab functions • Type the code in this handout in Matlab and investigate the results. • Write a Matlab function fibonacci.m to generate the Fibonacci series. This is generated by starting with zero and one and adding the last two numbers of the sequence to generate the next number in the series. Fibonacci series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ... • Create an graph of the Fibonacci series using the built-in plot Matlab function. Your graph should resemble figure 1 which contains a plot of the first 20 numbers in the sequence. • Plot the Fibonacci series in polar coordinates using the built-in Matlab polar function. Eccentricity (rho) should be the Fibonacci number and angle (theta) should vary with the Fibonacci number’s order in the sequence. Your plot should resemble figure 2 which is a polar plot of the first 10 numbers of the series. • Exit Matlab by typing quit and logout of Linux. >> quit Figure 1 Figure 2