SlideShare ist ein Scribd-Unternehmen logo
1 von 33
>> pathname = 'C:UsersAyaDesktoppic';
>> for i = 1:10
imagename = strcat(pathname,int2str(i),'.jpg');
I = imread(imagename);
M(i) = mean(mean(mean(I)));% RGB image
end
>> save 'C:UsersAyaDesktopMEANS.mat' M;
>> MR=load ('C:UsersAyaDesktopMEANS.mat')
MR =
M: [93.6082 93.6082 93.6082 93.6082 93.6082]
2
 Matlab plotting
› 2D plots
› 3D plots
 M-Files
› Scripts
› User defined functions
3
 Matlab has a lot of function for plotting
data.
 The basic one will plot one vector vs.
another. The first one will be treated as the
abscissa (or x) vector and the second as
the ordinate (or y) vector.
 The vectors have to be the same length.
 >> plot (time, dist) % plotting versus time
4
 Matlab will also plot a vector vs. its own
index. The index will be treated as the
abscissa vector.
 Given a vector “time” and a vector
“dist” we could say:
 >> plot (dist) % plotting versus index
5
 Example:
6
 Example:
7
 Example:
8
 Note: plot(g,h)  g and h must have same
length, direction
 Customize plot by editing in Figure Window
› Point and click edit mode with toolbar back
arrow
 Change axis property
 Change line style and color
 Change background color
 Add axis labels and title
 Insert legend and text
9
 There are commands in Matlab to
"annotate" a plot to put on axis labels,
titles, and legends.
 To put a label on the axes we would use:
› >> xlabel ('X-axis label')
› >> ylabel ('Y-axis label')
 To put a title on the plot, we would use:
› >> title ('Title of my plot')
10
 Make a 3-D line plot
› Create 3 same-length vectors, e.g.,
 >> p = [0:0.1:10]; % range vector
 >> q = p./2; % same length range vector
 >> r = sin(p).*cos(q); % function vector
› Plot the 3-D curve –
 Example: >> plot3(p,q,r)
› Rotate the curve in 3-D using toolbar icon
11
 Make a 3-D surface plot
› Create a matrix of function values
 Example: >> S = ((sin(p))') * (cos(q));
› Plot a surface of matrix values
 >> surf(S) % polygonal facets
 >> mesh(S) % wire mesh
› Rotate the plot in 3-D using toolbar icon
12
 Example:
 Supposed we want to visualize a function
Z = 10e(–0.4a) sin (2ft) for f = 2
when a and t are varied from 0.1 to 7 and 0.1 to 2,
respectively
 >>> [t,a] = meshgrid(0.1:.01:2, 0.1:0.5:7);
>>> f=2;
>>> Z = 10.*exp(-a.*0.4).*sin(2*pi.*t.*f);
>>> surf(Z);
>>> figure(2);
>>> mesh(Z);
13
14
 Example:
 >>> [x,y] = meshgrid(-
3:.1:3,-3:.1:3);
>>> z = 3*(1-x).^2.*exp(-
(x.^2) - (y+1).^2) ...
- 10*(x/5 - x.^3 -
y.^5).*exp(-x.^2-y.^2) ...
- 1/3*exp(-(x+1).^2 - y.^2);
>>> surf(z);
15
Graph Functions (summary)
 Plot linear plot
 stem discrete plot
16
 grid add grid lines
 xlabel add X-axis label
 ylabel add Y-axis label
 title add graph title
17
 subplot divide figure window
 figure create new figure window
 pause wait for user response
 hold on allows multiple plots on same axes
 clf clears the figure window
 axis([xmin,xmax,ymin,ymax]) controls axis properties
18
 Plotting Styles:
19
 Example:
› plot(x,y,’r’) is a red line
› plot(x,y,’o’) plots circles rather than lines
› plot(x,y,’yp’) plots yellow pentagrams
 Specialized 1D graphics
› bar--bar chart
› pie--pie chart
› polar--polar coordintes
› semilogy, semilogx, loglog—plotting with log-
scales
20
Drawing a bar graph
 >> clear, close all
>> clc
>> x = 0:pi/36:2*pi
>> y = cos(x)
>> bar(x,y,'b')
21
Drawing a stair-stop plot
 >> clear, close all
>> clc
>> x = -10:0.5:10
>> y = x.^2 + 2.*x + 2
>> stairs(x,y,'b')
22
Elements of Matlab as a programming
language:
› Expressions: Arithmetic, logical, etc.
› Flow Control blocks: Conditional and Iterations
› Scripts
› Functions
23
 When problems become complicated and require re–
evaluation, entering command at MATLAB prompt is not
practical
 M-files are text files containing Matlab programs. Can be
called form the command line or from other M-files
24
M-files: Scripts
 Without input
arguments,
they do not
return any
value.
25
 To run the M-file, type in the name of the file
at the prompt e.g. >>> test1
 It will be executed provided that the saved
file is in the known path
 Type in matlabpath to check the list of
directories listed in the path
 Use path editor to add the path: File --> Set
path …
26
M-files: Functions
 Function is a ‘black box’ that
communicates with workspace through
input and output variables.
27
M-files: Functions
 With parameters and returning values
 Only visible variables defined inside the
function or Parameters
 Usually one file for each function defined
 File must be saved to a known path with
filename the same as the function name and
with an extension ‘.m’
 Call function by its name and arguments
28
29
 Write a script/function that
converts a Roman numeral to its
decimal equivalent.
 You should be able to handle
the following conversion table:
 It will be useful to get the
Roman number into your
program as a string
 Matrix operators in Matlab are much faster than loops. Fast
Matlab code uses * and avoids loops
 Use built-in functions as they are often heavily optimized
 Minimize division – x/2 takes longer than 0.5*x
 Do computations outside loop
 Pre-allocate arrays
for j=1:n;a(j)=<something>;end
Setting a=zeros(1,n) before the loop speeds things up
 Use subfunctions
file fname.m:
function O=fname(I)
function O2=fname2(I2)
31
 http://www.cs.cornell.edu/Courses/cs401/2001fa
› Contains syllabus, lecture notes, examples, homework
 http://www.mathworks.com/matlabcentral/
32
 Advanced data objects (cell-arrays and
structs)
 Special tool boxes
 Simulink
 Graphical User Interface
33

Weitere ähnliche Inhalte

Was ist angesagt? (20)

MATLAB - Arrays and Matrices
MATLAB - Arrays and MatricesMATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
 
2D Plot Matlab
2D Plot Matlab2D Plot Matlab
2D Plot Matlab
 
Matlab lec1
Matlab lec1Matlab lec1
Matlab lec1
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
Intro to matlab
Intro to matlabIntro to matlab
Intro to matlab
 
Lecture three
Lecture threeLecture three
Lecture three
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics Tutorial
 
matlab
matlabmatlab
matlab
 
Basic concepts in_matlab
Basic concepts in_matlabBasic concepts in_matlab
Basic concepts in_matlab
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and Polynomial
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
 
Mat lab
Mat labMat lab
Mat lab
 
Arrays
ArraysArrays
Arrays
 
Matlab solved problems
Matlab solved problemsMatlab solved problems
Matlab solved problems
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
Matlab cheatsheet
Matlab cheatsheetMatlab cheatsheet
Matlab cheatsheet
 
Lecture one
Lecture oneLecture one
Lecture one
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
 

Andere mochten auch

RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...
RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...
RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...RuleML
 
Introduction to Neural networks (under graduate course) Lecture 5 of 9
Introduction to Neural networks (under graduate course) Lecture 5 of 9Introduction to Neural networks (under graduate course) Lecture 5 of 9
Introduction to Neural networks (under graduate course) Lecture 5 of 9Randa Elanwar
 
The Mapping Network Lake Mapping
The Mapping Network Lake MappingThe Mapping Network Lake Mapping
The Mapping Network Lake MappingThe Mapping Network
 
What is pattern recognition (lecture 5 of 6)
What is pattern recognition (lecture 5 of 6)What is pattern recognition (lecture 5 of 6)
What is pattern recognition (lecture 5 of 6)Randa Elanwar
 
Digital library construction
Digital library constructionDigital library construction
Digital library constructionRanda Elanwar
 
Earth science 14.1
Earth science 14.1Earth science 14.1
Earth science 14.1Tamara
 
Pattern recognition on human vision
Pattern recognition on human visionPattern recognition on human vision
Pattern recognition on human visionGiacomo Veneri
 
Introduction to Neural networks (under graduate course) Lecture 4 of 9
Introduction to Neural networks (under graduate course) Lecture 4 of 9Introduction to Neural networks (under graduate course) Lecture 4 of 9
Introduction to Neural networks (under graduate course) Lecture 4 of 9Randa Elanwar
 
Communications for Clean Water
Communications for Clean WaterCommunications for Clean Water
Communications for Clean WaterChoose Clean Water
 
Do Humans Beat Computers At Pattern Recognition
Do Humans Beat Computers At Pattern RecognitionDo Humans Beat Computers At Pattern Recognition
Do Humans Beat Computers At Pattern RecognitionBitdefender
 
Airborne LiDAR Bathymetry of the Great Barrier Reef
Airborne LiDAR Bathymetry of the Great Barrier ReefAirborne LiDAR Bathymetry of the Great Barrier Reef
Airborne LiDAR Bathymetry of the Great Barrier Reeffungis
 
Pattern Recognition and its Application
Pattern Recognition and its ApplicationPattern Recognition and its Application
Pattern Recognition and its ApplicationSajida Mohammad
 
The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...
The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...
The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...Luke Elliott
 
What is pattern recognition (lecture 4 of 6)
What is pattern recognition (lecture 4 of 6)What is pattern recognition (lecture 4 of 6)
What is pattern recognition (lecture 4 of 6)Randa Elanwar
 
What is pattern recognition (lecture 3 of 6)
What is pattern recognition (lecture 3 of 6)What is pattern recognition (lecture 3 of 6)
What is pattern recognition (lecture 3 of 6)Randa Elanwar
 
Pattern Recognition: digital identity, digital #curation and digital badges (...
Pattern Recognition: digital identity, digital #curation and digital badges (...Pattern Recognition: digital identity, digital #curation and digital badges (...
Pattern Recognition: digital identity, digital #curation and digital badges (...Joyce Seitzinger
 

Andere mochten auch (20)

RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...
RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...
RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logi...
 
Introduction to Neural networks (under graduate course) Lecture 5 of 9
Introduction to Neural networks (under graduate course) Lecture 5 of 9Introduction to Neural networks (under graduate course) Lecture 5 of 9
Introduction to Neural networks (under graduate course) Lecture 5 of 9
 
The Mapping Network Lake Mapping
The Mapping Network Lake MappingThe Mapping Network Lake Mapping
The Mapping Network Lake Mapping
 
What is pattern recognition (lecture 5 of 6)
What is pattern recognition (lecture 5 of 6)What is pattern recognition (lecture 5 of 6)
What is pattern recognition (lecture 5 of 6)
 
Digital library construction
Digital library constructionDigital library construction
Digital library construction
 
Earth science 14.1
Earth science 14.1Earth science 14.1
Earth science 14.1
 
Conowingo Presentation- USGS
Conowingo Presentation- USGSConowingo Presentation- USGS
Conowingo Presentation- USGS
 
Pattern recognition on human vision
Pattern recognition on human visionPattern recognition on human vision
Pattern recognition on human vision
 
Introduction to Neural networks (under graduate course) Lecture 4 of 9
Introduction to Neural networks (under graduate course) Lecture 4 of 9Introduction to Neural networks (under graduate course) Lecture 4 of 9
Introduction to Neural networks (under graduate course) Lecture 4 of 9
 
Icelandic Bathy model
Icelandic Bathy modelIcelandic Bathy model
Icelandic Bathy model
 
Hydro2016
Hydro2016Hydro2016
Hydro2016
 
Communications for Clean Water
Communications for Clean WaterCommunications for Clean Water
Communications for Clean Water
 
Do Humans Beat Computers At Pattern Recognition
Do Humans Beat Computers At Pattern RecognitionDo Humans Beat Computers At Pattern Recognition
Do Humans Beat Computers At Pattern Recognition
 
Airborne LiDAR Bathymetry of the Great Barrier Reef
Airborne LiDAR Bathymetry of the Great Barrier ReefAirborne LiDAR Bathymetry of the Great Barrier Reef
Airborne LiDAR Bathymetry of the Great Barrier Reef
 
Pattern Recognition and its Application
Pattern Recognition and its ApplicationPattern Recognition and its Application
Pattern Recognition and its Application
 
The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...
The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...
The Object Detection Capabilities of the Bathymetry Systems Utilised for the ...
 
Hawaii Pacific GIS Conference 2012: 3D GIS - Creating Bathymetry Maps with Co...
Hawaii Pacific GIS Conference 2012: 3D GIS - Creating Bathymetry Maps with Co...Hawaii Pacific GIS Conference 2012: 3D GIS - Creating Bathymetry Maps with Co...
Hawaii Pacific GIS Conference 2012: 3D GIS - Creating Bathymetry Maps with Co...
 
What is pattern recognition (lecture 4 of 6)
What is pattern recognition (lecture 4 of 6)What is pattern recognition (lecture 4 of 6)
What is pattern recognition (lecture 4 of 6)
 
What is pattern recognition (lecture 3 of 6)
What is pattern recognition (lecture 3 of 6)What is pattern recognition (lecture 3 of 6)
What is pattern recognition (lecture 3 of 6)
 
Pattern Recognition: digital identity, digital #curation and digital badges (...
Pattern Recognition: digital identity, digital #curation and digital badges (...Pattern Recognition: digital identity, digital #curation and digital badges (...
Pattern Recognition: digital identity, digital #curation and digital badges (...
 

Ähnlich wie Introduction to matlab lecture 4 of 4

MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptxMATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptxprashantkumarchinama
 
1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptxBeheraA
 
Ppt 2 d ploting k10998
Ppt 2 d ploting k10998Ppt 2 d ploting k10998
Ppt 2 d ploting k10998Vinit Rajput
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersMurshida ck
 
statistical computation using R- an intro..
statistical computation using R- an intro..statistical computation using R- an intro..
statistical computation using R- an intro..Kamarudheen KV
 
Fundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLABFundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLABAli Ghanbarzadeh
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabBilawalBaloch1
 
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
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentationManchireddy Reddy
 

Ähnlich wie Introduction to matlab lecture 4 of 4 (20)

Matlab anilkumar
Matlab  anilkumarMatlab  anilkumar
Matlab anilkumar
 
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptxMATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab1
Matlab1Matlab1
Matlab1
 
Es272 ch1
Es272 ch1Es272 ch1
Es272 ch1
 
1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
MatlabIntro (1).ppt
MatlabIntro (1).pptMatlabIntro (1).ppt
MatlabIntro (1).ppt
 
Ppt 2 d ploting k10998
Ppt 2 d ploting k10998Ppt 2 d ploting k10998
Ppt 2 d ploting k10998
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
statistical computation using R- an intro..
statistical computation using R- an intro..statistical computation using R- an intro..
statistical computation using R- an intro..
 
Dsp file
Dsp fileDsp file
Dsp file
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 
Fundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLABFundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLAB
 
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
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 

Mehr von Randa Elanwar

الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةRanda Elanwar
 
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةRanda Elanwar
 
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةRanda Elanwar
 
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةRanda Elanwar
 
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةRanda Elanwar
 
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةRanda Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5Randa Elanwar
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5Randa Elanwar
 
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونينتعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونينRanda Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7Randa Elanwar
 
Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)Randa Elanwar
 
يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)Randa Elanwar
 

Mehr von Randa Elanwar (20)

الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء السادس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
 
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الخامس ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
 
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الرابع ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
 
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثالث ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
 
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الثاني ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
 
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوةالجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
الجزء الأول ماذا ستقدم لعميلك ريادة الأعمال خطوة بخطوة
 
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص    )_Pdf5of5
تدريب مدونة علماء مصر على الكتابة الفنية (الترجمة والتلخيص )_Pdf5of5
 
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة  والأخطاء ال...
تدريب مدونة علماء مصر على الكتابة الفنية (القصة القصيرة والخاطرة والأخطاء ال...
 
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد   )_Pdf3of5
تدريب مدونة علماء مصر على الكتابة الفنية (مقالات الموارد )_Pdf3of5
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية  )_Pdf2of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات الإخبارية )_Pdf2of5
 
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
تدريب مدونة علماء مصر على الكتابة الفنية (المقالات المبنية على البحث )_Pdf1of5
 
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونينتعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
تعريف بمدونة علماء مصر ومحاور التدريب على الكتابة للمدونين
 
Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7Entrepreneurship_who_is_your_customer_(arabic)_7of7
Entrepreneurship_who_is_your_customer_(arabic)_7of7
 
Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7Entrepreneurship_who_is_your_customer_(arabic)_5of7
Entrepreneurship_who_is_your_customer_(arabic)_5of7
 
Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7Entrepreneurship_who_is_your_customer_(arabic)_4of7
Entrepreneurship_who_is_your_customer_(arabic)_4of7
 
Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7Entrepreneurship_who_is_your_customer_(arabic)_2of7
Entrepreneurship_who_is_your_customer_(arabic)_2of7
 
يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)يوميات طالب بدرجة مشرف (Part 19 of 20)
يوميات طالب بدرجة مشرف (Part 19 of 20)
 
يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)يوميات طالب بدرجة مشرف (Part 18 of 20)
يوميات طالب بدرجة مشرف (Part 18 of 20)
 
يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)يوميات طالب بدرجة مشرف (Part 17 of 20)
يوميات طالب بدرجة مشرف (Part 17 of 20)
 
يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)يوميات طالب بدرجة مشرف (Part 16 of 20)
يوميات طالب بدرجة مشرف (Part 16 of 20)
 

Kürzlich hochgeladen

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Kürzlich hochgeladen (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Introduction to matlab lecture 4 of 4

  • 1.
  • 2. >> pathname = 'C:UsersAyaDesktoppic'; >> for i = 1:10 imagename = strcat(pathname,int2str(i),'.jpg'); I = imread(imagename); M(i) = mean(mean(mean(I)));% RGB image end >> save 'C:UsersAyaDesktopMEANS.mat' M; >> MR=load ('C:UsersAyaDesktopMEANS.mat') MR = M: [93.6082 93.6082 93.6082 93.6082 93.6082] 2
  • 3.  Matlab plotting › 2D plots › 3D plots  M-Files › Scripts › User defined functions 3
  • 4.  Matlab has a lot of function for plotting data.  The basic one will plot one vector vs. another. The first one will be treated as the abscissa (or x) vector and the second as the ordinate (or y) vector.  The vectors have to be the same length.  >> plot (time, dist) % plotting versus time 4
  • 5.  Matlab will also plot a vector vs. its own index. The index will be treated as the abscissa vector.  Given a vector “time” and a vector “dist” we could say:  >> plot (dist) % plotting versus index 5
  • 9.  Note: plot(g,h)  g and h must have same length, direction  Customize plot by editing in Figure Window › Point and click edit mode with toolbar back arrow  Change axis property  Change line style and color  Change background color  Add axis labels and title  Insert legend and text 9
  • 10.  There are commands in Matlab to "annotate" a plot to put on axis labels, titles, and legends.  To put a label on the axes we would use: › >> xlabel ('X-axis label') › >> ylabel ('Y-axis label')  To put a title on the plot, we would use: › >> title ('Title of my plot') 10
  • 11.  Make a 3-D line plot › Create 3 same-length vectors, e.g.,  >> p = [0:0.1:10]; % range vector  >> q = p./2; % same length range vector  >> r = sin(p).*cos(q); % function vector › Plot the 3-D curve –  Example: >> plot3(p,q,r) › Rotate the curve in 3-D using toolbar icon 11
  • 12.  Make a 3-D surface plot › Create a matrix of function values  Example: >> S = ((sin(p))') * (cos(q)); › Plot a surface of matrix values  >> surf(S) % polygonal facets  >> mesh(S) % wire mesh › Rotate the plot in 3-D using toolbar icon 12
  • 13.  Example:  Supposed we want to visualize a function Z = 10e(–0.4a) sin (2ft) for f = 2 when a and t are varied from 0.1 to 7 and 0.1 to 2, respectively  >>> [t,a] = meshgrid(0.1:.01:2, 0.1:0.5:7); >>> f=2; >>> Z = 10.*exp(-a.*0.4).*sin(2*pi.*t.*f); >>> surf(Z); >>> figure(2); >>> mesh(Z); 13
  • 14. 14
  • 15.  Example:  >>> [x,y] = meshgrid(- 3:.1:3,-3:.1:3); >>> z = 3*(1-x).^2.*exp(- (x.^2) - (y+1).^2) ... - 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) ... - 1/3*exp(-(x+1).^2 - y.^2); >>> surf(z); 15
  • 16. Graph Functions (summary)  Plot linear plot  stem discrete plot 16
  • 17.  grid add grid lines  xlabel add X-axis label  ylabel add Y-axis label  title add graph title 17
  • 18.  subplot divide figure window  figure create new figure window  pause wait for user response  hold on allows multiple plots on same axes  clf clears the figure window  axis([xmin,xmax,ymin,ymax]) controls axis properties 18
  • 20.  Example: › plot(x,y,’r’) is a red line › plot(x,y,’o’) plots circles rather than lines › plot(x,y,’yp’) plots yellow pentagrams  Specialized 1D graphics › bar--bar chart › pie--pie chart › polar--polar coordintes › semilogy, semilogx, loglog—plotting with log- scales 20
  • 21. Drawing a bar graph  >> clear, close all >> clc >> x = 0:pi/36:2*pi >> y = cos(x) >> bar(x,y,'b') 21
  • 22. Drawing a stair-stop plot  >> clear, close all >> clc >> x = -10:0.5:10 >> y = x.^2 + 2.*x + 2 >> stairs(x,y,'b') 22
  • 23. Elements of Matlab as a programming language: › Expressions: Arithmetic, logical, etc. › Flow Control blocks: Conditional and Iterations › Scripts › Functions 23
  • 24.  When problems become complicated and require re– evaluation, entering command at MATLAB prompt is not practical  M-files are text files containing Matlab programs. Can be called form the command line or from other M-files 24
  • 25. M-files: Scripts  Without input arguments, they do not return any value. 25
  • 26.  To run the M-file, type in the name of the file at the prompt e.g. >>> test1  It will be executed provided that the saved file is in the known path  Type in matlabpath to check the list of directories listed in the path  Use path editor to add the path: File --> Set path … 26
  • 27. M-files: Functions  Function is a ‘black box’ that communicates with workspace through input and output variables. 27
  • 28. M-files: Functions  With parameters and returning values  Only visible variables defined inside the function or Parameters  Usually one file for each function defined  File must be saved to a known path with filename the same as the function name and with an extension ‘.m’  Call function by its name and arguments 28
  • 29. 29
  • 30.  Write a script/function that converts a Roman numeral to its decimal equivalent.  You should be able to handle the following conversion table:  It will be useful to get the Roman number into your program as a string
  • 31.  Matrix operators in Matlab are much faster than loops. Fast Matlab code uses * and avoids loops  Use built-in functions as they are often heavily optimized  Minimize division – x/2 takes longer than 0.5*x  Do computations outside loop  Pre-allocate arrays for j=1:n;a(j)=<something>;end Setting a=zeros(1,n) before the loop speeds things up  Use subfunctions file fname.m: function O=fname(I) function O2=fname2(I2) 31
  • 32.  http://www.cs.cornell.edu/Courses/cs401/2001fa › Contains syllabus, lecture notes, examples, homework  http://www.mathworks.com/matlabcentral/ 32
  • 33.  Advanced data objects (cell-arrays and structs)  Special tool boxes  Simulink  Graphical User Interface 33