ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.

Slides:



Advertisements
Similar presentations
Lab # 03- SS Basic Graphic Commands. Lab Objectives: To understand M-files principle. To plot multiple plots on a single graph. To use different parameters.
Advertisements

Lecture 5.
ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
CSE 123 Plots in MATLAB. Easiest way to plot Syntax: ezplot(fun) ezplot(fun,[min,max]) ezplot(fun2) ezplot(fun2,[xmin,xmax,ymin,ymax]) ezplot(fun) plots.
Introduction to Engineering MATLAB – 11 Plotting - 4 Agenda Multiple curves Multiple plot.
Plotting Selim Aksoy Bilkent University Department of Computer Engineering
Lecture (4) Plotting & Programming (1) Eng. Osama Talaat 1.
2D Plots 1 ENGR 1181 MATLAB 12.
Introduction to Graphing Using MATLAB. Line Graphs  Useful for graphing functions  Useful for displaying data trends over time  Useful for showing.
Matlab Graphics S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: 2D Graphics.
1 Chapter 4 Curve Plotting with MATLAB MATLAB provides some very powerful features for plotting and labeling curves. These operations can be performed.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
ENGR-25_TYU_chp02.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_Lec-29_MS_Excel-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
1. Overview 2. plot in 2D 3. Plot in 3D 4. Other possible charts 5. Engineers: label your plots! 6. Plots & Polynomial Plotting 11.
MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 4.
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
MATLAB - Lecture 22A Two Dimensional Plots / Chapter 5 Topics Covered:
EGR106 Week 6 MATLAB FILES Two Dimensional Plots Multiple Plots
Vectors and Plotting Selim Aksoy Bilkent University Department of Computer Engineering
MATLAB Week 3 17 November Outline Graphics – Basic plotting – Editing plots from GUI – Editing plots from m-file – Advanced plotting commands.
EGR106 Week 4 Two Dimensional Plots Multiple Plots Plot Formatting Homework.
MTH15_Lec-08_sec_2-3_Higher_Order_Derivatives_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
EPSII 59:006 Spring Outline Managing Your Session File Usage  Saving Workspace  Loading Data Files  Creating M-files More on Matrices Review.
For loop Khairul anwar.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
MTH15_Lec-14_sec_3-2_Concavity_Inflection_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
MTH15_Lec-15_sec_3-3_Curve_Sketching.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
PLOTS AND FIGURES DAVID COOPER SUMMER Plots One of the primary uses for MATLAB is to be able to create publication quality figures from you data.
ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 1 in MATLAB Topics Covered: 1.Plotting basic 2-D plots The plot()
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5 Advanced.
CMPS 1371 Introduction to Computing for Engineers PLOTTING.
MATLAB Plotting With MATLAB 1. Two Dimensional Plots The xy plot is the most commonly used plot by engineers The independent variable is usually called.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
MTH15_Lec-09_sec_2-4_Derivative_Chain_Rule_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-10_sec_2-5_Incrementals_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-12_sec_3-1_Rel_Extrema_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-11_sec_2-6_Implicit_Diff_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MATLAB for Engineers, by Holly Moore. ISBN © 2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is.
ENGR-25_Lec-28_Excel-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
Lecture 10 2D plotting & curve fitting Subplots Other 2-D Plots Other 2-D Plots Curve fitting © 2007 Daniel Valentine. All rights reserved. Published by.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5 Advanced.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
Plot (x-values, y-values) >> x = linspace (-3, 3, 20); >> x = linspace (-3, 3, 20); >> y = 2*x – 1; >> y = 2*x – 1; >> plot (x, y) >> plot (x, y)
Recap Chapter 5 “Plotting” Two Dimensional Plots Simple x-y Plots Titles, Labels and Grids Multiple Plots.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Introduction to Engineering MATLAB – 9 Plotting - 2 Agenda Formatting plots.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.1 Simple Plot of Time.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Lab 2 : potting to Matlab Networks.
EGR 106 – Week 5 – 2-D Plots Question : Why do engineers use plots? Answer : To analyze, visualize, and present data. Matlab has many useful plotting options.
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
Prof. N. P. Jadhav Presented by. Overview of MATLAB environment MATLAB is an interactive, matrix-based system for scientific and engineering numeric computation.
Creating a Plot The plot function can take one or more inputs; e.g. plot (x, y) or plot (y) Note that in the two-argument version, the vectors x and.
Plotting Chapter 5.
Lecture 25: Exploring data
Matrices and Arrays.
Net 222: Communications and networks fundamentals (Practical Part)
MATLAB How to use (using M-files) Double click this icon
§2.4 Derivative Chain Rule
MATLAB How to use (using M-files) Double click this icon
MATLAB How to use (using M-files)
Introduction to MATLAB Plotting LAB 3
Plotting Signals in MATLAB
Presentation transcript:

ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer Engr/Math/Physics 25 Chp5 MATLAB Plots & Models 2

ENGR-25_Plot_Model-2.ppt 2 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

ENGR-25_Plot_Model-2.ppt 3 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Learning Goals cont  Construct using MATLAB SemiLog and LogLog Cartesian Plots  Use MATLAB’s InterActive Plotting Utility to Fine-Tune Plot Appearance  Create “Linear-Transform” Math Models for measured Physical Data Linear Function → No Xform Power Function → Log-Log Xform Exponential Function → SemiLog Xform

ENGR-25_Plot_Model-2.ppt 4 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

ENGR-25_Plot_Model-2.ppt 5 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Learning Goals cont  Build Math Models for Physical Data using “n th ” 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

ENGR-25_Plot_Model-2.ppt 6 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Why Plot?  Engineering, Math, and Science are QUANTITATIVE Endeavors, we want NUMBERS as Well as Words  Many times we Need to Understand The (functional) relationship between two or More Variables Compare the Values of MANY Data Values

ENGR-25_Plot_Model-2.ppt 7 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Plot Title Axis Title Tic Mark Tic Mark Label Legend Data Symbol Annotations Axis UNITS Connecting Line

ENGR-25_Plot_Model-2.ppt 8 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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.

ENGR-25_Plot_Model-2.ppt 9 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SubPlot Example  Consider an End-Loaded Cantilever Beam  In ENGR36 & ENGR45 we will learn how the Applied Force-Load, F, affects the Beam

ENGR-25_Plot_Model-2.ppt 10 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

ENGR-25_Plot_Model-2.ppt 11 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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 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);

ENGR-25_Plot_Model-2.ppt 12 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SubPlot Example  Next Make 3 subplots in an array with THREE Rows and ONE Column >> subplot(3,1,1) >> plot(XoverL,V), xlabel('x/L'), ylabel('V/Vmax'),... title('Cantilever Beam - Shear'), grid >> subplot(3,1,2) >> plot(XoverL,M), xlabel('x/L'), ylabel('M/Mmax'),... title('Cantilever Beam - Bending'), grid >> subplot(3,1,3) >> plot(XoverL,y), xlabel('x/L'), ylabel('y/ymax'),... title('Cantilever Beam - Deflection'), grid

ENGR-25_Plot_Model-2.ppt 13 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods SubPlot Result Demo SubPlot_3x2_Thk_Lines_1103.m

ENGR-25_Plot_Model-2.ppt 14 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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 then v versus u 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,’:’).

ENGR-25_Plot_Model-2.ppt 15 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods DataMark & LineType Example  To plot y versus x with green asterisks (*) connected with a red dashed line, again plot the data twice by typing plot(x,y,’g*’,x,y,’r--’)  Example: Mechanical Creep  Consider a PolyStryene Cantilever Beam (c.f. sld-8) Heavily Loaded for a “long” time

ENGR-25_Plot_Model-2.ppt 16 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

ENGR-25_Plot_Model-2.ppt 17 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

ENGR-25_Plot_Model-2.ppt 18 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods DataMaker & LineType Result

ENGR-25_Plot_Model-2.ppt 19 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods More: Markers, Lines, Colors  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 (  ).*sdp.*sdp Line types Solid line Dashed line Dash-dotted line Dotted line –– – –. …. Colors Black Blue Cyan Green Magenta Red White Yellow kbcgmrwykbcgmrwy † Other data markers are available. Search for “markers” or “LineSpec” in MATLAB help.  Don’t forget the 'LineWidth', n Command to make thicker lines

ENGR-25_Plot_Model-2.ppt 20 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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”  We Now wish to plot e −0.3t to Show the ENVELOPE of Exponential Decay

ENGR-25_Plot_Model-2.ppt 21 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Labeling Curves Example  Use Defaults for the main Function, V(t)  Use Red, Dashed (--) Lines for the d(t) Decay  The Calc and Plot statements >> t = [0:0.02:9]; >> V_t = (exp(-0.3*t)).*(9*cos(13*t)); >> d1 = 9*exp(-0.3*t); >> d2 = -9*exp(-0.3*t); >> plot(t,V_t, t, d1, 'r--', t, d2, 'r--'), xlabel('t'),... ylabel('V'), title('RLC Repsonse'),grid,... legend('Sinusoidal Oscillations', ’Exponential Decay')

ENGR-25_Plot_Model-2.ppt 22 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods legend Use Result

ENGR-25_Plot_Model-2.ppt 23 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Labeling Curves with gtext  The gtext Command allows the USER to Place the curve Labels at Any Location on the Plot with the Mouse.  Let’s use gtext(‘string’) to Label the Decaying Sinusoid Plot with Labels Located in Close Proximity with the two Curves

ENGR-25_Plot_Model-2.ppt 24 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods gtext Use Result

ENGR-25_Plot_Model-2.ppt 25 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods The hold command TYU T5.2-5  The hold Command “Freezes” plots for subsequent modification.  Illustrate by T5.2-5 Example  Say we Want to Plot over 0  x  1  Over this Range These functions are too difficult to Distinguish for gtext Labeling  Solution → Plot & Label y 1 First Plot & Label y 2 2 nd

ENGR-25_Plot_Model-2.ppt 26 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Making BETTER Plots  The following actions, while not required, can nevertheless improve the appearance & clarity of your plots: 1.Start scales from Zero when possible –This prevents a false impression of the magnitudes of variations shown on the plot  Invalid if we want to emphasize DIFFERENCES 2.Use sensible tick-mark spacing –If the quantities are months, choose a spacing of 12 because 1/10 of a year is not a convenient division.

ENGR-25_Plot_Model-2.ppt 27 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Making BETTER Plots cont –Tic marks should be Neither “Too” Course/Fine 3.Minimize the number of Zeros and Scientific-Notation in the data being plotted –For example, use a scale in µW (microWatts) to show Power Data Ranging Over – Watts (11 – 137 µW) 4.Determine the min & max data values for each axis before plotting the data. Then set the axis limits to cover the entire data range (or Span) plus an additional amount to allow for clearly understood tick-marking

ENGR-25_Plot_Model-2.ppt 28 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Making BETTER Plots cont –e.g; if the data on the x-axis ranges from 1.2 to 9.6, a good choice for axis limits is 0 to 10  This choice permits a tick spacing of 1 or 2. 5.Use a different line type for each curve when several are plotted on a single plot and they cross each other; –For example, use a solid line, a dashed line, and combinations of lines and symbols.  Beware of using colors to distinguish plots if you are going to make black-and-white printouts and/or photocopies.

ENGR-25_Plot_Model-2.ppt 29 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Making BETTER Plots cont 6.Do not put too many curves on one plot, particularly if they will –Be close to each other –Cross one another at several points. 7.Use the same scale limits and tick spacing on each plot if you, or the plot Users, need to compare information on more than one plot. –This is VERY Important  The Instructor Made this Mistake on the 1 st Draft of His 1 st Publication – Luckily a colleague spotted the error during her careful review of the draft

ENGR-25_Plot_Model-2.ppt 30 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Proper Comparison Scaling Same Scales

ENGR-25_Plot_Model-2.ppt 31 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Select Plot: WorkSpace Browser >> a = linspace(0,10,500); >> y = 4*cos(a)-22*sin(1.5*a+4);

ENGR-25_Plot_Model-2.ppt 32 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Select Plot: WorkSpace Browser  Results can be a Plot of your choice >> B =[7, 19, 23, 3,17, 11] B =

ENGR-25_Plot_Model-2.ppt 33 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Other Useful Plots CommandPlot Description bar(x,y) Bar chart of y versus x. plotyy(x1,y1,x2,y2) Produces a plot with two y-axes, y1 on the left and y2 on the right polar(theta,r,’type’) Polar plot from the polar coordinates theta and r, using the line type, data marker, and colors specified in the string type. stairs(x,y) Stairs plot of y versus x stem(x,y) Stem plot of y versus x.

ENGR-25_Plot_Model-2.ppt 34 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Column & Bar Chart  MATLAB Col Chart >> Y = round(rand(5,3)*10); >> bar(Y,'stack')  MATLAB Bar Chart

ENGR-25_Plot_Model-2.ppt 35 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Greek Letters on Plots ( ΠΣλξ )  Use the “\” then a “Character Sequence” in a Labeling Field

ENGR-25_Plot_Model-2.ppt 36 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Greek Letters on Plots ( ωφΘΔ )  Use the “\” then a “Character Sequence” in a Labeling Field

ENGR-25_Plot_Model-2.ppt 37 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods In the Greek….

ENGR-25_Plot_Model-2.ppt 38 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Greek Code % Bruce Mayer, PE % ENGR-25 02Jul13 % XY_fcn_Graph_6x6_BlueGreen_BkGnd_Template_1306.m % % The FUNCTION x = linspace(-6,6,500); y = -x.^2/3 +5.5; % % The ZERO Lines zxh = [-6 6]; zyh = [0 0]; zxv = [0 0]; zyv = [-6 6]; % % the 6x6 Plot axes; set(gca,'FontSize',12); whitebg([ ]); % Chg Plot BackGround to Blue-Green plot(x,y, zxv,zyv, 'k', zxh,zyh, 'k', 'LineWidth', 3),axis([ ]),... grid, xlabel('\fontsize{18}\Theta'), ylabel('\fontsize{18}\Psi = \phi(\Theta)'),... title(['\fontsize{16}ENGR25 Engr Honor Soc \rightarrow \tau-\beta-\pi',]),... annotation('textbox',[ ], 'FitBoxToText', 'on', 'EdgeColor', 'none', 'String', '- \infty','FontSize',48)

ENGR-25_Plot_Model-2.ppt 39 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Plot Additions  hold non / off  Use the hold command to add lines, markers, and others with DIFFERENT formatting to an Existing Plot  Some Help Searches that assist with formatting Text Properties LineSpec

ENGR-25_Plot_Model-2.ppt 40 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Example  hold non / off

ENGR-25_Plot_Model-2.ppt 41 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods hold non / off Code % Bruce Mayer, PE % ENGR-25 01Jul13 % XY_fcn_Graph_BlueGreenBkGnd_Solid_Marker_Template1306.m % % The Limits xmin = -3; xmax1 = 1; xmin2 = xmax1; xmax = 3; ymin = -4; ymax = 10; % The FUNCTION x1 = linspace(xmin,xmax1,500); y1 = 1-x1.^2; x2 = linspace(xmin2,xmax,500); y2 = 3*x2+1; % % The ZERO Lines zxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ymin ymax]; % % the BASE Plot axes; set(gca,'FontSize',12); whitebg([ ]); % Chg Plot BackGround to Blue-Green plot(x1,y1,'b', x2,y2,'b', x1(end),y1(end), 'ob', 'MarkerSize', 16, 'MarkerFaceColor', [ ],... 'LineWidth', 5),axis([xmin xmax ymin ymax]),... grid, xlabel('\fontsize{16}\chi'), ylabel('\fontsize{16}y \equiv \phi(\chi)'),... title(['\fontsize{16}ENGR25 Bruce Mayer, PE HOLD',]),... annotation('textbox',[ ], 'FitBoxToText', 'on', 'EdgeColor', 'none', 'String', 'XYfcnGraphBlueGreenBkGndSolidMarkerTemplate1306.m','FontSize',7) % % Turn-ON hold to ADD to BASE Plot Lines & Markers of different formats hold on plot(x2(1),y2(1), 'ob', 'MarkerSize', 11, 'MarkerFaceColor', 'g') plot(zxv,zyv, 'k', zxh,zyh, 'k', 'LineWidth', 3) plot([xmin xmax], [4 4], '-.m', [1 1], [ymin ymax], '-.m', 'LineWidth', 2) set(gca,'XTick',[xmin:1:xmax]); set(gca,'YTick',[ymin:1:ymax]) hold off

ENGR-25_Plot_Model-2.ppt 42 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Dual Y-Axis Plot

ENGR-25_Plot_Model-2.ppt 43 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods poltyy in MATLAB

ENGR-25_Plot_Model-2.ppt 44 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods stairs Plot – sin(x) >> x=0:0.25:10; >> stairs(x,sin(x));

ENGR-25_Plot_Model-2.ppt 45 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods stem Plot - >> x = 0:0.1:4; >> y = sin(x.^2).*exp(-x); >> stem(x,y)

ENGR-25_Plot_Model-2.ppt 46 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods TYU T5.3-3 Polar Plot  Archimedes Spiral  The interactive Session  The BMayer Plot >> theta = linspace(0, 4*pi, 500); >> a = 2; >> r = a*theta; >> subplot(1,1,1) >> polar(theta, r), title('Spiral of Archimedes')

ENGR-25_Plot_Model-2.ppt 47 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods All Done for Today SeaShell Built on Archimedes Spiral

ENGR-25_Plot_Model-2.ppt 48 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer Engr/Math/Physics 25 Appendix

ENGR-25_Plot_Model-2.ppt 49 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods gtext Demo  The Command Session >> t = [0:0.02:9]; >> V_t = (exp(-0.3*t)).*(9*cos(13*t)); >> d1 = 9*exp(-0.3*t); >> d2 = -9*exp(-0.3*t); >> plot(t,V_t, t, d1, 'r--', t, d2, 'r--'), xlabel('t'),... ylabel('V'), title('RLC Repsonse'),grid,... gtext('Sinusoid'), gtext('Exponential Decay'),... gtext('Exponential Decay') TWO “Exponential Decay” Labels; one each for the TOP and BOTTOM Curves –Demo_Chp5_gtext_6010.m

ENGR-25_Plot_Model-2.ppt 50 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods hold Demo >> x = [0:0.01:1]; >> y1 = sin(x); y2 = x-x.^3/3; >> plot(x,y1), gtext('sin(x)'), hold, plot(x,y2), xlabel('x'),... ylabel('y'), gtext('x-x^3/3') Current plot held Formatting Info