Download MATLAB Plots and Models: Learning Goals and Techniques and more Slides Calculus for Engineers in PDF only on Docsity!
Engr/Math/Physics 25
Chp5 MATLAB
Plots & Models 2
Learning Goals
- List the Elements of a COMPLETE Plots
- e.g.; axis labels, legend, units, etc.
- Construct Complete Cartesian (XY) plots
using MATLAB
- Modify or Specify MATLAB Plot Elements: Line Types, Data Markers,Tic Marks
- Distinguish between INTERPolation
and EXTRAPolation
Learning Goals cont
- Use Regression Analysis as quantified by
the āLeast Squaresā Method
- Calculate
- Sum-of-Squared Errors (SSE or J)
- The Squared Errors are Called āResidualsā
- āBest Fitā Coefficients
- Sum-of-Squares About the Mean (SSM or S)
- Coefficient of Determination (r 2 )
- Scale Data if Needed
- Creates more meaningful spacing
Learning Goals cont
- Build Math Models for Physical Data using
ānth^ ā Degree Polynomials
- Use MATLABās āBasic Fittingā Utility to find
Math models for Plotted Data
- Use MATLAB to Produce 3-Dimensional
Plots, including
- Surface Plots
- Contour Plots
Sys3 2X200 MultiBlok, 997671 250-13.8 PreWeld ā P (^) i Tube-
0
25
50
75
100
125
150
175
200
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 Hole Number (1 = closest to Manifold Block)
Individual Hole
Ļ P (10X Torr)
DNS Tube-1 BMayer Tube DNS Normalized BMayer Normalized
PARAMETERS ⢠For Single Tube Manifold
- Flow = ??/0.24 slpm/hole⢠Exh to Atm Pressure (~750Torr)
- Test Engr = DNStoddard, BMayer⢠Test Date = 09Mar00/10Mar
file = HbH997671PreW09Mar00.xls
Tic Mark
Tic Mark Label
Axis UNITS (^) Data Symbol Connecting Line
SubPlots
- The subplot command creates several smaller ā subplots ā in the same figure.
- The syntax is subplot(m,n,p)
- This command divides the Figure window into an array of rectangular panes with m rows and n columns.
- The variable p tells MATLAB to place the output of the plot command following the subplot command into the p th^ pane.
SubPlot Example
- By the ENGR36 & ENGR45 Methods Analyze how the load affects the Beam in Terms of - SHEARING Force, V - BENDING-Moment, M - Vertical DEFLECTION, y - The V, M, and y functions vs the Normalized Distance Dimension x/L
b h x
y
L
F
( ) (^1) max
VV x = (^) FF =
( ) ( ) (^1) max
MM x = F ā
FLx ā L = x ā LL = Lx ā
( ) 
 
 (^) ā    ļ£ ļ£·     ļ£ =    
   
 = (^21) ļ£ļ£«  ā (^3) ļ£ļ£«  21 3
3 2 2 max L
x L
x L
x L
x y
y x
SubPlot Example
- We Want to Plot V, M, and y ON TOP of each other vs the common independent Variable, x/L
- This is a perfect Task for subplot
- First Construct the functions
b h (^) x
y
L
F
- Note the use of the ones Command to construct the Constant Shear (V) vector
**>> XoverL = [0:0.01:1]; V = ones(1, length(XoverL))
M = XoverL - 1; y = 0.5((XoverL).^2) .(XoverL -3);**
SubPlot Result
(^00) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1
2
x/L
V/Vmax
Cantilever Beam - Shear
-1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-0.
0
x/L
M/Mmax
Cantilever Beam - Bending
-1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-0.
0
x/L
y/ymax
Cantilever Beam - Deflection
Data-Markers & Line-Types
- The Data Marker and Line Type specifications in a Plot consist of optional Fields in the Basic plot statement
- To plot y versus x with a solid line and u versus v with a dashed line, type plot(x,y,u,v,ā-- ā) - The symbols ā -- ā represent a dashed line
- To plot y versus x with asterisks () connected with a dotted line, we must plot the data twice by typing plot(x,y,āā,x,y,ā:ā).
DataMark & LineType Example
ļ§ We Would Like to plot the Vertical Deflection, Y, versus time, t, for a Constant Load using
- Blue Colored Data Makers in the from of a + mark
- Magenta Colored Dash-Dot (- .) Line to connect the Data Points
DataMark & LineType Example
- The Command Session for the Creep Plot
- The Data Set as Row Vectors **>> delY_mm = [0, 2, 4, 4.5, 5.5, 6, 6.5, 8, 9, 11];
t_min = [0, 2, 4, 6, 9, 12, 15, 18, 21, 24];**
- The Plot Statement >> plot(t_min,delY_mm, āb+ā, t_min,delY_mm, 'm-.ā),... xlabel('Load Application Time, t (min)'),... ylabel('Vertical Deflection, y (mm)'),... title('Polystrene Cantilever Beam Creep'), grid
- Notice the Data is plotted Twice
- Notice also the Blue- Plus, and Magenta Dash-Dot Specs
More: Markers, Lines, Colors
- Donāt forget the 'LineWidth', n Command to make thicker lines
- MATLAB Provides a Wide Range of Options for Plot-Lines & Plot-Markers Data markersā Dot (.) Asterisk (*) Cross (Ć) Circle ( ) Plus sign (+) Square ( ) Diamond ( ) Five-pointed star (ļ¶) . * Ć + s d p
Line types Solid line Dashed line Dash-dotted line Dotted line
āā
Colors Black Blue Cyan Green Magenta Red White Yellow
k b c g m r w y
ā (^) Other data markers are available. Search for āmarkersā or āLineSpecā in MATLAB help.
Labeling Curves
- The legend command automatically obtains from the plot the line type used for each data set and displays a sample of this line type in the legend box next to the selected text-string ļ§ For Example again Consider RLC Circuit āRingingā
V ( ) t = ( 9 V ) e ā^0.^3 t^ cos 13 t ( ) ( )
t d t V e
- 3 9
ā = ±
ļ§ We Now wish to plot eā0.3t^ to Show the ENVELOPE of Exponential Decay