SlideShare a Scribd company logo
1 of 18
Download to read offline
Basic Guidelines for MATLAB Programming
By
RANJAN PAL
Ph.D. Research Scholar
IIT Kharagpur
1
2
MATLAB window
(1) Directory where you save your files
(2) Script file(3) Saved
files in your
current
directory
(4) MATLAB Workspace
(5) Command window
Commonly used commands
3
Command Name Usage
disp displays message in command window
fprintf Prints the i/o msg in command window
n takes you to next line
t acts like a space bar
clc clears command window
clear all clears all the data stored in workspace
%’some txt msg’ its for user information
In the beginning of every code, when you define a function, remember that
the name of function and the name that you save for .m file should be same
4
Matrix Calculations in COMMAND window
Write nos. from 1 to 10 >> H=1:10
Let M=[1 2; 3 4] and N=[4 5 ;6 7],
Matrix Multiplication >> R=M*N
Element wise multiplication >> S=M.*N
Let A=[4 5 6] and B=[7 8 9] i.e. two vectors
Dot product is given by, >> C=dot(A,B)
Cross Product is given by, >> D=cross(A,B)
Create 4*4 identity matix >> eye(4)
3*2 matrix, all elements are 1 >> ones(3,2)
3*2 matrix, all elements are 0 >> zeros(3,2)
Operations Write these in COMMAND window
Define matrix >> A=[1 2 3;4 5 6; 7 8 9]
Transpose of A >>B=A'
All elements of 2nd column of matrix A >> C=A(:,2)
All elements of 2nd row of matrix A >> D=A(2,:)
Size of matrix A >> E=size(A)
1st & 2nd row and 2nd & 3rd column >> F=A(1:2,2:3)
Extract A13 element of matrix A >> G=A(1,3)
Define 1D array (Matrix of 1*n)
clear all;
clc;
% No of rows by default is 1 i.e m=1
% matrix is of the form : a1j
n=input('Enter the column size of array:n ')
a=1:n % a is matrix of size : 1*n
disp('Enter the elements of matrix:a ')
for j=1:n
a(1,j)=input('') % if a=1*n matrix ,then a11 a12 a13 ...........a 1n
end
5
Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension
Enter ‘F5’ to run the programme
clear all;
clc;
m=input('Enter the row size of array:m ')
n=input('Enter the column size of array:n ')
a=[m;n] % a is Matrix of size a(m*n)
disp('Enter the elements of matrix :a ')
for i=1:m
for j=1:n
a(i,j)=input('') % if a=2*3 matrix ,then a11 a12 a13 then a21 a22 a23
end
end
disp(a)
6
Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension
Enter ‘F5’ to run the programme
Define 2D array (Matrix of m*n)
Basics of function handlers
• Lets say we have f=x+y, And we need to find f(4,5)
• In matlab, to achieve this ,we make use of function handlers
• In matlab command window, write this:
>>f = @(x,y) (x+y); % Press enter
>>F=f(4,5) % Press enter
(*You get the desired value i.e. 9*)
(*Observe what happens when you remove the (;) symbol *)
7
Obtaining the roots of Transcendental Eq
by function handling ‘@(x)’
when you know approximately where the root lies
We define a function as follows:
>> f = @(x) cos(x) * cosh(x) + 1 ; % cos(x)*cosh(x)+1=0
>> fzero(f,2)
ans =
1.8751
 This is just to tell you that MATLAB has many inbuilt functions to solve a given
problem like roots of equations, ode etc.
 You can explore them for you interest
 But not to be used in exams 8
Plot more than 1 curve: ‘Sub-Plot’
9
Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension
Enter ‘F5’ to run the programme
• Prepare this excel file that contains two sheets
• Save this file with the name ‘Square Cube.xlsx’
10
Read From Excel File - 1
Sheet 1 ‘Square’ Sheet 2: ‘cube’
Read From Excel File - 2
11
Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension
Enter ‘F5’ to run the programme
Making your function
12
PROBLEM SUM
13
Make your own function
14
GET INPUT VALUES FROM THE USER
and CALL the user defined function
15
To run the programme, you can follow any one of the below mentioned steps:
1) press F5 in MATLAB editor, after you have saved the ‘Run_this_code.m’ file
2) click the ‘Run’ option in MATLAB editor
Run the Programme
16
O/P of Euler Cauchy for ODE
17
Points to Remember
• This PPT is to give you basic idea about MATLAB programming, it
doesn't teach you MATLAB thoroughly.
• You need to explore it more yourself.
• You can take help of https://www.mathworks.com/ for syntax and
learn new commands
18

More Related Content

What's hot (20)

Matlab Overviiew
Matlab OverviiewMatlab Overviiew
Matlab Overviiew
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlab
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
What is matlab
What is matlabWhat is matlab
What is matlab
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Importance of matlab
Importance of matlabImportance of matlab
Importance of matlab
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
Matlab Workshop Presentation
Matlab Workshop PresentationMatlab Workshop Presentation
Matlab Workshop Presentation
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrix
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
 
Matlab Tutorial
Matlab TutorialMatlab Tutorial
Matlab Tutorial
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
Basics of programming in matlab
Basics of programming in matlabBasics of programming in matlab
Basics of programming in matlab
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
Matlab programming project
Matlab programming projectMatlab programming project
Matlab programming project
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
 
Matlab Functions
Matlab FunctionsMatlab Functions
Matlab Functions
 

Similar to Basics of MATLAB programming

Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabvikrammutneja1
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013amanabr
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Kurmendra Singh
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabBilawalBaloch1
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdfsrxerox
 
Matlab ch1 intro
Matlab ch1 introMatlab ch1 intro
Matlab ch1 introRagu Nathan
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01Wingston
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkreddyprasad reddyvari
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make YASHU40
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabTarun Gehlot
 
C programming session 01
C programming session 01C programming session 01
C programming session 01Vivek Singh
 

Similar to Basics of MATLAB programming (20)

1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab functions
Matlab functionsMatlab functions
Matlab functions
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
Matlab ch1 intro
Matlab ch1 introMatlab ch1 intro
Matlab ch1 intro
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 
Tutorial2
Tutorial2Tutorial2
Tutorial2
 
Es272 ch1
Es272 ch1Es272 ch1
Es272 ch1
 
Dsp file
Dsp fileDsp file
Dsp file
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Palm m3 chapter1b
Palm m3 chapter1bPalm m3 chapter1b
Palm m3 chapter1b
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
 
Chapter 1.ppt
Chapter 1.pptChapter 1.ppt
Chapter 1.ppt
 

Recently uploaded

EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

Basics of MATLAB programming

  • 1. Basic Guidelines for MATLAB Programming By RANJAN PAL Ph.D. Research Scholar IIT Kharagpur 1
  • 2. 2 MATLAB window (1) Directory where you save your files (2) Script file(3) Saved files in your current directory (4) MATLAB Workspace (5) Command window
  • 3. Commonly used commands 3 Command Name Usage disp displays message in command window fprintf Prints the i/o msg in command window n takes you to next line t acts like a space bar clc clears command window clear all clears all the data stored in workspace %’some txt msg’ its for user information In the beginning of every code, when you define a function, remember that the name of function and the name that you save for .m file should be same
  • 4. 4 Matrix Calculations in COMMAND window Write nos. from 1 to 10 >> H=1:10 Let M=[1 2; 3 4] and N=[4 5 ;6 7], Matrix Multiplication >> R=M*N Element wise multiplication >> S=M.*N Let A=[4 5 6] and B=[7 8 9] i.e. two vectors Dot product is given by, >> C=dot(A,B) Cross Product is given by, >> D=cross(A,B) Create 4*4 identity matix >> eye(4) 3*2 matrix, all elements are 1 >> ones(3,2) 3*2 matrix, all elements are 0 >> zeros(3,2) Operations Write these in COMMAND window Define matrix >> A=[1 2 3;4 5 6; 7 8 9] Transpose of A >>B=A' All elements of 2nd column of matrix A >> C=A(:,2) All elements of 2nd row of matrix A >> D=A(2,:) Size of matrix A >> E=size(A) 1st & 2nd row and 2nd & 3rd column >> F=A(1:2,2:3) Extract A13 element of matrix A >> G=A(1,3)
  • 5. Define 1D array (Matrix of 1*n) clear all; clc; % No of rows by default is 1 i.e m=1 % matrix is of the form : a1j n=input('Enter the column size of array:n ') a=1:n % a is matrix of size : 1*n disp('Enter the elements of matrix:a ') for j=1:n a(1,j)=input('') % if a=1*n matrix ,then a11 a12 a13 ...........a 1n end 5 Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension Enter ‘F5’ to run the programme
  • 6. clear all; clc; m=input('Enter the row size of array:m ') n=input('Enter the column size of array:n ') a=[m;n] % a is Matrix of size a(m*n) disp('Enter the elements of matrix :a ') for i=1:m for j=1:n a(i,j)=input('') % if a=2*3 matrix ,then a11 a12 a13 then a21 a22 a23 end end disp(a) 6 Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension Enter ‘F5’ to run the programme Define 2D array (Matrix of m*n)
  • 7. Basics of function handlers • Lets say we have f=x+y, And we need to find f(4,5) • In matlab, to achieve this ,we make use of function handlers • In matlab command window, write this: >>f = @(x,y) (x+y); % Press enter >>F=f(4,5) % Press enter (*You get the desired value i.e. 9*) (*Observe what happens when you remove the (;) symbol *) 7
  • 8. Obtaining the roots of Transcendental Eq by function handling ‘@(x)’ when you know approximately where the root lies We define a function as follows: >> f = @(x) cos(x) * cosh(x) + 1 ; % cos(x)*cosh(x)+1=0 >> fzero(f,2) ans = 1.8751  This is just to tell you that MATLAB has many inbuilt functions to solve a given problem like roots of equations, ode etc.  You can explore them for you interest  But not to be used in exams 8
  • 9. Plot more than 1 curve: ‘Sub-Plot’ 9 Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension Enter ‘F5’ to run the programme
  • 10. • Prepare this excel file that contains two sheets • Save this file with the name ‘Square Cube.xlsx’ 10 Read From Excel File - 1 Sheet 1 ‘Square’ Sheet 2: ‘cube’
  • 11. Read From Excel File - 2 11 Write this programme as a ‘SCRIPT’ file and save with ‘.m’ extension Enter ‘F5’ to run the programme
  • 14. Make your own function 14
  • 15. GET INPUT VALUES FROM THE USER and CALL the user defined function 15
  • 16. To run the programme, you can follow any one of the below mentioned steps: 1) press F5 in MATLAB editor, after you have saved the ‘Run_this_code.m’ file 2) click the ‘Run’ option in MATLAB editor Run the Programme 16
  • 17. O/P of Euler Cauchy for ODE 17
  • 18. Points to Remember • This PPT is to give you basic idea about MATLAB programming, it doesn't teach you MATLAB thoroughly. • You need to explore it more yourself. • You can take help of https://www.mathworks.com/ for syntax and learn new commands 18