3D-Graphs A 3D surface is defined as: z = f(x, y)

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
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.
Introduction to M ATLAB 2 Graphics Ian Brooks Institute for Climate & Atmospheric Science School of Earth & Environment
1. Overview 2. plot in 2D 3. Plot in 3D 4. Other possible charts 5. Engineers: label your plots! 6. Plots & Polynomial Plotting 11.
Introduction to Matlab:
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
MATLAB GRAPHICS 2-D.
MATLAB - Lecture 22A Two Dimensional Plots / Chapter 5 Topics Covered:
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.
Introduction to Matlab 332:202 Discrete Mathematics Spring 2007.
Plotting. Basic Plotting Two vectors of x and y values needed. Vectors need to be of the same length, but not necessarily of the same geometry. For example,
Introduction to Matlab Jianguo Wang CSSCR September 2009.
 1999 BG Mobasseri1 8/29/2015 MATLAB GRAPHICS - PART II ADVANCED PLOTTING June 4, ‘99.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
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()
1 Advanced Plotting ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem
CMPS 1371 Introduction to Computing for Engineers PLOTTING.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files.
Barak Shenhav Early Evolution Course 11 Feb 2001 MATLAB Visualization, Functions & Debugging.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
Recap Chapter 5 “Plotting” Two Dimensional Plots Simple x-y Plots Titles, Labels and Grids Multiple Plots.
Recap Plots with More than one Line Plots of Complex Arrays Line, Color and Mark Style Axis Scaling and Annotating Plots Subplots Polar Plots Logarithmic.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
ELG 3120 Lab 2 TAs Wei Zhang Ozgur Ekici (Section A) (Section B)
EGR 115 Introduction to Computing for Engineers Complex Numbers & 3D Plots – Part 2 Friday 07 Nov 2014 EGR 115 Introduction to Computing for Engineers.
Program design and algorithm development We will consider the design of your own toolbox to be included among the toolboxes already available with your.
GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Deniz Savas & Mike Griffiths May 2015.
Introduction to Engineering MATLAB – 9 Plotting - 2 Agenda Formatting plots.
Figures & Axes, Printing & Saving. Outline Announcements –Homework I on web, due Wed. 5PM by –No lecture on Fri. 10/26, rescheduled to Wed. 10/31.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Lab 2 : potting to Matlab Networks.
EEE 242 Computer Tools for Electrical Engineering Lecture II Mustafa Karabulut.
ייצוגים גרפיים ב - MATLAB. 2 יעדים לימודיים סרטוט גרפים עם מערכת צירים xy  בחירת רזולוציה לציר ה- x  סרטוט כמה גרפים על אותה מערכת צירים  סרטוט כמה.
EEE 242 Computer Tools for Electrical Engineering
Figures & Axes, Printing & Saving. Outline Announcements –Homework I on web, due Wed. 5PM by e- mail A word on HWI and cookies What happens when you plot.
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.
Lecture 17 More Plotting Chapter 12 Matrices. Outline from Chapter D Plotting 11.4 Surface Plots 11.5 Interacting with Plotted Data.
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
Session III Plotting in MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU MATLAB Tutorials.
CS112 Scientific Computation Department of Computer Science Wellesley College Kodak moments 3-D Visualization and Color.
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.
Plots and Graphics.
Computer Application in Engineering Design
Introduction to Mat lab
Lecture 25.
Ch3 Graphics Overview of Plotting Editing Plots
Lecture 25: Exploring data
Matrices and Arrays.
MatLab – Palm Chapter 5 2-D & 3-D Plots
Net 222: Communications and networks fundamentals (Practical Part)
Net 222: Communications and networks fundamentals (Practical Part)
Net 222: Communications and networks fundamentals (Practical Part)
MATLAB How to use (using M-files) Double click this icon
MATLAB How to use (using M-files) Double click this icon
Today’s Lecture Matlab Graphics
MATLAB How to use (using M-files)
Introduction to MATLAB Plotting LAB 3
CSCI N317 Computation for Scientific Applications Unit 1 – 5 MATLAB
Yang-Ming University, Taipei, Taiwan
Plotting Signals in MATLAB
Designing Effective Graphics Using MATLAB
How to Use MATLAB A Brief Introduction.
Introduction to Matlab
Presentation transcript:

3D-Graphs A 3D surface is defined as: z = f(x, y) We will create 3D surfaces using 2 functions: mesh(x, y, z); surf(x, y, z); mesh(X,Y,Z) draws a wireframe mesh with color determined by Z, so color is proportional to surface height. If X andY are vectors, length(X) = n and length(Y) = m, where [m,n] = size(Z)

Example colormap colormap([1 0 0]) is red colormap([0 1 0]) is green [X,Y] = meshgrid(-8:.5:8); R = sqrt(X.^2 + Y.^2) + eps; Z = sin(R)./R; figure mesh(Z) xlabel('x'); ylabel('y'); zlabel('z'); colormap colormap([1 0 0]) is red colormap([0 1 0]) is green colormap([0 0 1]) is blue

Adding Plots to an Existing Graph For example, these statements first create a contour plot of the peaks function, then superimpose a pcolor (pseudocolor) plot of the same function: % Obtain data from evaluating peaks function [x,y,z] = peaks; % Create pseudocolor plot pcolor(x,y,z) % Remove edge lines a smooth colors shading interp % Hold the current graph hold on % Add the contour graph to the pcolor graph contour(x,y,z,20,'k') % Return to default hold off The hold on command combines the pcolor plot with the contour plot in one figure.

Clearing the Figure for a New Plot When a figure already exists, most plotting commands clear the axes and use this figure to create the new plot. However, these commands do not reset figure properties, such as the background color or the colormap. If you have set any figure properties in the previous plot, you might want to use the clf command with the reset option, clf reset before creating your new plot to restore the figure’s properties to their defaults.

Dis playing Multiple Plots in One Figure The subplot command enables you to display multiple plots in the same window or print them on the same piece of paper. Typing subplot(m,n,p) partitions the figure window into an m-by-n matrix of small subplots and selects the pth subplot for the current plot. The plots are numbered along the first row of the figure window, then the second row, and so on.

playing Multiple Plots in One Figure For example, these statements plot data in four different subregions of the figure window: t = 0:pi/10:2*pi; [X,Y,Z] = cylinder(4*cos(t)); subplot(2,2,1); mesh(X) subplot(2,2,2); mesh(Y) subplot(2,2,3); mesh(Z) subplot(2,2,4); mesh(X,Y,Z) Controlling the Axes The axis command provides a number of options for setting the scaling, orientation, and aspect ratio of graphs

Automatic Axis Limits and Tick Marks By default, MATLAB finds the maxima and minima of the data and chooses the axis limits to span this range. MATLAB selects the limits and axis tick mark values to produce a graph that clearly displays the data. However, you can set your own limits using the axis or xlim, ylim, and zlim functions.

Setting Axis Limits The axis command enables you to specify your own limits: axis([xmin xmax ymin ymax]) or for three-dimensional graphs, axis([xmin xmax ymin ymax zmin zmax]) Use the command axis auto to enable automatic limit selection again.

Setting Axis Visibility You can use the axis command to make the axis visible or invisible. axis on makes the axes visible. This is the default. axis off makes the axes invisible Setting Grid Lines The grid command toggles grid lines on and off. The statement grid on turns the grid lines on, and grid off turns them back off again

Adding Axis Labels, Titles and Text The xlabel, ylabel, and zlabel commands add x-, y-, and z-axis labels. The title command adds a title at the top of the figure and the text function inserts text anywhere in the figure. You can produce mathematical symbols using LaTeX notation in the text string, as the following example illustrates:

Adding Axis Labels and Titles t = -pi:pi/100:pi; y = sin(t); plot(t,y) axis([-pi pi -1 1]) xlabel('-\pi \leq {\itt} \leq \pi') ylabel('sin(t)') title('Graph of the sine function') text(0.5,-1/3,'{\itNote the odd symmetry.}') The location of the text string is defined in axes units (that is, the same units as the data).