![Page 1: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/1.jpg)
MCE 372 Engineering Analysis
MATLAB Review
![Page 2: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/2.jpg)
MATLAB – What Is It ? Where Is It?
Name is from matrix laboratory Powerful tool for
– Computation and visualization of engineering, science and mathematics
– Communication of ideas– Programming:
Built-in editor, debugger, and help Many predefined functions (grouped in toolboxes) Interpreted or compiled programs
Located on all ECC PC’s & in many department facilities
![Page 3: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/3.jpg)
How Do We Want To Use MATLAB
In This Course?
Write Simple MATLAB Programs to Do the Following:
- Perform Particular Calculations
- Display/Plot Results for Interpretation
![Page 4: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/4.jpg)
Creating Your Own ProgramScript (m-file) Concept
M-file is a collection of MATLAB commands – Can be re-executed – Is easily changed/modified, transferred or e-mailed
File format: Name.m Commands are executed one by one sequentially
– File is executed by typing its name (without .m)– Results appear in the command window (or use ; )
Can be created using any text editor, but is most easily developed in MATLAB Editor Window
![Page 5: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/5.jpg)
Boot Up Default MATLAB Window
Help menu provides answers to most questions
Opens Editor Window to create new program
In this window: - type & edit commands- test & run program- save work when finished
![Page 6: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/6.jpg)
Demo MATLAB CodeCalculate & Plot Equation: y=2x+30x2-2x3
Dot needed for element-by-element operation
Semicolon used to suppress output to Command Window – commonly desired
![Page 7: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/7.jpg)
Plotting Line Specifiers
Line Specifiers Change the LookEspecially Handy When Plotting Several Lines on Same GraphUse Help Menu to Find Out More
![Page 8: MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization](https://reader030.vdocuments.net/reader030/viewer/2022032722/56649f505503460f94c72eea/html5/thumbnails/8.jpg)
Example Code% MCE 372 Demo Program% Make Multiple Plots on Same Axes with Legendsclc;clear all;clfx=0:0.1:10;y1=2*x+30*x.^2;y2=10*x.^3;y3=200*x% Plot all functions on same axesplot(x,y1,'k','linewidth',2)hold on;grid onplot(x,y2,'b','linewidth',2)plot(x,y3,'r','linewidth',2)xlabel('x');ylabel('y')title('MCE 372 Demo Plot')legend('y1','y2','y3')
0 1 2 3 4 5 6 7 8 9 100
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
x
y
MCE 372 Demo Plot
y1
y2y3