PSY8219 : Week 6. Homework 5 Due Today. Homework 6 Due October 8. Readings for Today Attaway Chapter 6, 10, and 12
|
|
- Abner Austin
- 5 years ago
- Views:
Transcription
1 Homework 5 Due Today PSY8219 : Week 6 Homework 6 Due October 8 Readings for Today Attaway Chapter 6, 10, and 12 Readings for Next Week Attaway Chapter 12 and 13
2 Turning in Homework Assignments Remember to include EVERYTHING needed to run your homework assignment (even if it includes files than I give you as part of the assignment). If you need to submit more than one file, please submit one ZIP file.
3 function x = testfun1(y, x) y = y + 1; x = x + y; end x = 1; y = 2; z = testfun1(x, y); x + y + z
4 function x = testfun1(y, x) y = y + 1; x = x + y; end x = 1; y = 2; testfun1(testfun1(x, y), x)
5 function y = testfun2(x) if x > 1 y = x + testfun2(x-1) else y = x; end a = 3; b = testfun2(a); b
6 function y = testfun3(x) global zzz; zzz = x-1; y = zzz-x; end global zzz; zzz = 5; x = 2; x = testfun3(x+zzz); x+zzz
7 function testfun3(a, b) clear all; end clear all; a = 1; b = 2; testfun4(a, b) a+b
8 function testfun5(fun) x = 0:pi/50:10*pi; plot(x,fun(x)); end fun testfun5(fun); testfun5(@cos); testfun5(@testfun6); testfun5(@testfun7);
9
10 Create a function that computes x! (factorial)
11
12 Graphing in Matlab
13 A not uncommon data flow in research experiment data file Excel SPSS Excel raw data is organized, summarized, and reformatted in Excel by hand reformatted data is analyzed in SPSS or SAS using menu options summarized data with MSe read into Excel and graphs are created by hand
14 A not uncommon data flow in research experiment data file Excel SPSS Excel raw data is organized, summarized, and reformatted in Excel by hand reformatted data is analyzed in SPSS or SAS using menu options summarized data with MSe read into Excel and graphs are created by hand Advantages you understand your data Disadvantages possible mistakes, slow, no record of steps
15 Potentially more efficient approach experiment data file Matlab, Python, or R reorganization, reformatting, summary, analyses, graphs are automated
16 Potentially more efficient approach experiment data file Matlab, Python, or R reorganization, reformatting, summary, analyses, graphs are automated Advantages quick, avoid careless errors, record of steps Disadvantages can remove yourself from your data if you do not include descriptive analyses
17 Potentially more efficient approach experiment data file Matlab, Python, or R reorganization, reformatting, summary, analyses, graphs are automated You never want to go from raw data straight to statistical analyses without also doing descriptive analyses (histograms, graphs of data, etc.), but you can automate
18 we ll only cover a tiny fraction of all the graphing options available in Matlab
19 x = 1:.01:5; y = sin(x); plot(x,y); x = [ ]; y = [ ]; bar(x,y); What is happening behind the scenes when plot() or bar() is called?
20 x = [ ]; y = [ ]; bar(x,y); is there a current figure window? no yes create a figure window draw graph in current figure window
21 x = [ ]; y = [ ]; bar(x,y); plot(x,y); is there a current figure window? no yes create a figure window overwrite graph in current figure window
22 x = [ ]; y = [ ]; hold on; bar(x,y); plot(x,y);
23 x = [ ]; y = [ ]; hold on; bar(x,y); plot(x,y); is there a current figure window? yes no create a figure window no is hold on? yes overwrite graph in current figure window add to graph in current figure window
24 x = [ ]; y = [ ]; hold on; bar(x,y); plot(x,y); hold off; bar(y,x); is there a current figure window? yes no create a figure window no is hold on? yes overwrite graph in current figure window add to graph in current figure window
25 figure; create a new figure window make it the current figure window close; close current figure window clf; clear current figure window
26 figure; create a new figure window make it the current figure window close all; close all figure window clf; clear current figure window
27 figure(n); does figure n exist? no create figure window n make figure n the current figure window yes make figure n the current figure window close(n); close figure window n clf(n); clear figure window n
28 What will this do? f1 = figure; f2 = figure; f3 = figure; plot(x,y); figure(f2); plot(x,exp(y)); figure(f3); plot(x,log(y));
29 What will this do? figure(1); figure(2); figure(3); plot(x,y); figure(2); plot(x,exp(y)); figure(3); plot(x,log(y));
30 What will this do? figure(1); figure(2); hold on; plot(x,y); figure(1); bar(x,y); figure(2); plot(x,x+y); figure(1); plot(x,2*y);
31 Formatting You need to realize the internally Matlab has a hierarchical representation of figures. root figure GUI objects axes plot objects other objects
32 handles fh = figure; x = 1:.01:5; y = sin(x); ph = plot(x,y);
33 Formatting figure windows figure(1) % create or use existing % figure with handle h=1 h = figure; % creates a brand new figure % returning its handle h h = figure('color', [1 1 0], % background 'Name', 'My Figure', % name window 'DockControls', 'off', % controls 'Menubar', 'none', % menu 'Visible', 'off'); % visible
34 Formatting figure windows h = figure('name', 'My Figure'); % name window common calling convention in Matlab and other languages calling by property/value pairs internally using the varargin parameter
35 h1 = figure; Formatting figure windows set(h1, 'Name', 'Test', 'Menubar', 'none'); You can format a figure window after you create it using set(), passing it the figures handle.
36 Formatting figure windows h = gcf; set(h, 'Name', 'Test', 'Menubar', 'none'); gcf gets the handle for the current figure.
37 Formatting Graphs Formatting when a graph is created. x = 0:pi/100:4*pi; y1 = sin(x); y2 = cos(x); y3 = tan(x); plot(x,y1,x,y2); plot(x,[y1 ; y2]); equivalent, except for some formatting hold on; plot(x,y1); plot(x,y2); multidimensional arrays too You can put multiple plots on the same graph.
38 Formatting Graphs Will this work? Why or why not? x = 0:pi/100:4*pi; y1 = sin(x); y2 = cos(x); plot(x,[y1 y2]);
39 Formatting Graphs Will this work? Why or why not? x = 0:pi/100:4*pi; y1 = sin(x); y2 = cos(x); plot(x,[y1 ; y2]);
40 Formatting Graphs What will this do? Will it work? What will it look like? x = [1 2 3]; y = [1 2 3 ; ; 3 2 1]; plot(x,y,'o-');
41 Formatting Graphs What will this do? Will it work? What will it look like? x = [ ]; y = [ ]; plot(x,y,'loglog');
42 Formatting Graphs Format graph when created. Shorthand for line type. plot(x,y1,'-or'); Line Style Marker Color
43 Formatting Graphs Format graph when created. Shorthand for line type. plot(x,y1,'-or'); plot(x,y2,'b--x'); plot(x,-y1, -or',x,-y2,'-*b');
44 Formatting Graphs Format graph when created. Shorthand for line type. x = [ ]; y1 = [ ]; y2 = [ ]; bar(x,y1,'red'); bar(x,y1,y2,'stacked');
45 Formatting Graphs Format graph when created. Shorthand for line type. x = [ ]; y1 = [ ]; y2 = [ ]; What do you think this will do? bar(x,[y1 ; y2],'stacked');
46 Formatting Graphs Format graph when created. Shorthand for line type. x = [ ]; y1 = [ ]; y2 = [ ]; What do you think this will do? bar(x,[y1 ; y2],'stacked'); Why do you need to do this? bar(x',[y1 ; y2]','stacked');
47 Formatting the Current Axes. x = 0:.1:10; y1 = x.*exp(-x); y2 = 1./x; Formatting Graphs plot(x,y1,'r',x,y2,'b'); axis([xmin xmax ymin ymax]); e.g., axis([ ]); e.g., axis([min(x) max(x) min([y1 y2]) max([y1 y2])]); what is this doing?
48 Formatting the Current Axes. x = 0:.1:10; y1 = x.*exp(-x); y2 = 1./x; Formatting Graphs plot(x,y1,'r',x,y2,'b'); xlim([xmin xmax]); ylim([ymin ymax]);
49 plot(x,y1,'r',x,y2,'b'); axis([ ]); title('this is a title'); xlabel('x axis label'); ylabel('y axis label'); Formatting Graphs
50 Getting the axes handle. Formatting Graphs h = plot(x,y1); or plot(x,y1); h = gca;
51 Getting the axes handle. h = plot(x,y1,'b-o'); get(h) Formatting Graphs w = get(h, 'LineWidth'); set(h, 'LineWidth', 3*w); set(h, 'Marker', 'x'); set(h, 'Color', [.5.3.1]);
52 Formatting Graphs Many graphics elements have handle that can be set. h = plot(x,y1,'b-o'); t = title('my Title ); get(t); set(t, 'FontName', 'Arial'); set(t, 'FontSize', 24); set(t, 'Color', [1 1 0]);
53 Some other formatting commands tl = legend('condition 1', 'condition 2', 'Location', 'NorthEast'); th = text(1.0, 1.5, 'This is a text string'); get(tl); % see what properties there are set(tl, Property Name, Property Value); % set properties
54 Some other formatting commands x = 0:.1:10; y = x.*exp(-x); ph = plot(x,y,'r ); get(ph);
55 see MoreOnHandle.m (in Week6.zip)
56 e.g., errorbar(x,y,e); plotyy(x,y1,x,y2); loglog(x,y); semilogx(x,y); semilogy(x,y); barh(x,y); rose(theta,x); polar(theta,r); stem(x,y); pie(x); Some various plots in Matlab
57 Subplots You can create multiple graphs within the same figure window. x = 1:pi/10:2*pi; subplot(2,2,1); plot(x,sin(x)); subplot(2,2,2); plot(x,tan(x)); subplot(2,2,3); plot(x,log(x)); subplot(2,2,4); plot(x,sin(x)/cos(x));
58 Saving graphs to a file Remember, you can create a graph without showing the figures on the screen, which takes time and resources. And you might be running it in the background. h = figure('visible', 'off');... print('-dpdf', '-r300', 'myfig'); type dpi fname
59 Saving graphs to a file Remember, you can create a graph without showing the figures on the screen, which takes time and resources. And you might be running it in the background. h = figure('visible', 'off');... print('-dtiff', '-r300', 'myfig'); type dpi fname
60 Saving graphs to a file Remember, you can create a graph without showing the figures on the screen, which takes time and resources. And you might be running it in the background. h = figure('visible', 'off');... print('-djpeg', '-r300', 'myfig'); type dpi fname
61
62 3D plots e.g., plot3(); bar3(); stem3(); pie3();
63 3D plots
64 3D plots
65 3D plots What is this? 1 $ exp& 2πσ 2 % 2 (x µ) 2σ 2 ' ) (
66 3D plots What do you think this is? 1 ( ) 2π Σ exp 1 2 (x µ)t Σ 1 (x µ) $ x ' x = & ) %& y () $ µ = µ ' & x ) & µ ) % y ( $ 2 σ x σ x σ y Σ = & & 2 σ x σ y σ %& y ' ) ) ()
67 3D plots multivariate normal distribution (pdf) x = [1 ; 2]; mu = [1 ; 1]; sig = [1 0; 0 1]; f1 = (1/(2*pi*det(sig))) *... exp(-(1/2)*(x-mu)'*inv(sig)*(x-mu)); - or - f2 = mvnpdf(x, mu, sig); how can we plot this multivariate pdf?
68 z = f(x,y) z y x
69 z = f(x,y) z y a grid of (x,y) points x
70 z = f(x,y) z calculate z=f(x,y) over the grid of (x,y) points y a grid of (x,y) points x
71 3D plots xinc = 1; yinc = 1; xlims = -3:xinc:4; ylims = -2:yinc:5; [X Y] = meshgrid(xlims, ylims); size(x) size(y) X Y
72 [X Y] = meshgrid(xlims, ylims); z y x
73 [X Y] = meshgrid(xlims, ylims); z y let s view this straight on x
74 [X Y] = meshgrid(xlims, ylims); y x
75 [X Y] = meshgrid(xlims, ylims); y x
76 x y [X Y] = meshgrid(xlims, ylims);
77 3D plots [X Y] = meshgrid(xlims, ylims); How would we create Z, which has the same dimensions as X and Y?
78 3D plots [X Y] = meshgrid(xlims, ylims); How would we create Z, which has the same dimensions as X and Y? for i=1:size(x,1) for j=1:size(x:2) Z(i,j) = mvnpdf([x(i,j) Y(i,j)], mu, sig); end end
79 3D plots [X Y] = meshgrid(xlims, ylims); Matlab shortcut: Z = mvnpdf([x(:) Y(:)], mu', sig); Z = reshape(z, size(x,1), size(x,2));
80 3D plots Surface Plot surf(x, Y, Z);
81 3D plots Change Color Maps colormap(gray); surf(x, Y, Z); colormap(hot); surf(x, Y, Z);
82 3D plots Mesh Plot mesh(x, Y, Z);
83 3D plots Contour Plot contour(x, Y, Z);
84 Contour plus Surface Plot surfc(x, Y, Z); 3D plots Hmmmmm. You can t see the contours. Why?
85 3D plots Also this: ezsurfc('y/(1 + x^2 + y^2)',[-5,5,-2*pi,2*pi],35);
86 3D plots Compare pdf with random numbers drawn from distribution mu = [1 ; 1]; sig = [2.8;.8 1]; [X Y] = meshgrid(xlims, ylims); Z = mvnpdf([x(:) Y(:)], mu', sig); Z = reshape(z, size(x,1), size(x,2)); subplot(1,2,1); contour(x, Y, Z); pts = mvnrnd(mu, sig, 1000); subplot(1,2,2); plot(pts(:,1),pts(:,2),'*');
87 3D plots Some more formatting/graphing possibilities peaks(60) % built-in example function z = 3*(1-x).^2.* exp(-(x.^2) - (y+1).^2) *(x/5 - x.^3 - y.^5).* exp(-x.^2-y.^2) /3*exp(-(x+1).^2 - y.^2)
88 3D plots Some more formatting/graphing possibilities Z = peaks(60); subplot(1,3,1); surf(z); subplot(1,3,2); contour(z); subplot(1,3,3); contourf(z); The X and Y mesh grid are assumed to be the array indices if no X and Y matrices are passed to the plotting function.
89 3D plots Some more formatting/graphing possibilities contourf(peaks(60)); colormap(jet(8)); hcb = colorbar('yticklabel',... {'Freezing','Cold','Cool','Neutral',... 'Warm','Hot','Burning','Nuclear'}); set(hcb,'ytickmode','manual');
90 3D plots Some more formatting/graphing possibilities figure; contourf(peaks(60)); colormap(jet(8)); hcb = colorbar(... 'Location','SouthOutside','XTickLabel',... {'Freezing','Cold','Cool','Neutral',... 'Warm','Hot','Burning','Nuclear'}); set(hcb,'xtickmode','manual');
91 Viewing Arrays/Matrices imagine wanting to visualize an array or matrix A = [ ; ; ]; A = peaks(60); A = mvnpdf([x(:) Y(:)], mu', sig); A = reshape(a, size(x,1), size(x,2)); In all three cases, A is just a matrix. bar3(a); contour(a); surf(a); imagesc(a);
92 images are just arrays Viewing Arrays/Matrices load penny.mat subplot(1,3,1); surf(p); subplot(1,3,2); contour(p); subplot(1,3,3); imagesc(p);
Mechanical Engineering Department Second Year (2015)
Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most
More informationINTRODUCTION TO MATLAB PLOTTING WITH MATLAB
1 INTRODUCTION TO MATLAB PLOTTING WITH MATLAB Plotting with MATLAB x-y plot Plotting with MATLAB MATLAB contains many powerful functions for easily creating plots of several different types. Command plot(x,y)
More informationLecture 6: Plotting in MATLAB
Lecture 6: Plotting in MATLAB Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE21: Computer Applications. See Textbook Chapter 5. A picture is worth a thousand words MATLAB allows
More informationPROGRAMMING WITH MATLAB WEEK 6
PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines
More informationClasses 7-8 (4 hours). Graphics in Matlab.
Classes 7-8 (4 hours). Graphics in Matlab. Graphics objects are displayed in a special window that opens with the command figure. At the same time, multiple windows can be opened, each one assigned a number.
More informationGraphics Example a final product:
Basic 2D Graphics 1 Graphics Example a final product: TITLE LEGEND YLABEL TEXT or GTEXT CURVES XLABEL 2 2-D Plotting Specify x-data and/or y-data Specify color, line style and marker symbol (Default values
More informationBasic Graphs. Dmitry Adamskiy 16 November 2011
Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken
More informationIntroduction to MATLAB
Introduction to MATLAB Violeta Ivanova, Ph.D. MIT Academic Computing violeta@mit.edu http://web.mit.edu/violeta/www/iap2006 Topics MATLAB Interface and Basics Linear Algebra and Calculus Graphics Programming
More informationOverview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab
Overview Lecture 13: Graphics and Visualisation Graphics & Visualisation 2D plotting 1. Plots for one or multiple sets of data, logarithmic scale plots 2. Axis control & Annotation 3. Other forms of 2D
More informationFF505/FY505 Computational Science. MATLAB Graphics. Marco Chiarandini
FF505/FY505 Computational Science MATLAB Marco Chiarandini (marco@imada.sdu.dk) Department of Mathematics and Computer Science (IMADA) University of Southern Denmark Outline 1. 2D Plots 3D Plots 2 Outline
More informationINTRODUCTION TO MATLAB
1 of 18 BEFORE YOU BEGIN PREREQUISITE LABS None EXPECTED KNOWLEDGE Algebra and fundamentals of linear algebra. EQUIPMENT None MATERIALS None OBJECTIVES INTRODUCTION TO MATLAB After completing this lab
More informationIntroduction to MATLAB
Introduction to MATLAB Violeta Ivanova, Ph.D. Office for Educational Innovation & Technology violeta@mit.edu http://web.mit.edu/violeta/www Topics MATLAB Interface and Basics Calculus, Linear Algebra,
More informationLab of COMP 406 Introduction of Matlab (II) Graphics and Visualization
Lab of COMP 406 Introduction of Matlab (II) Graphics and Visualization Teaching Assistant: Pei-Yuan Zhou Contact: cspyzhou@comp.polyu.edu.hk Lab 2: 19 Sep., 2014 1 Review Find the Matlab under the folder
More informationProf. Manoochehr Shirzaei. RaTlab.asu.edu
RaTlab.asu.edu Introduction To MATLAB Introduction To MATLAB This lecture is an introduction of the basic MATLAB commands. We learn; Functions Procedures for naming and saving the user generated files
More informationIntroduction to Matlab
NDSU Introduction to Matlab pg 1 Becoming familiar with MATLAB The console The editor The graphics windows The help menu Saving your data (diary) Solving N equations with N unknowns Least Squares Curve
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More information2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command...
Contents 2D LINE PLOTS... 1 The plot() Command... 1 Labeling and Annotating Figures... 5 The subplot() Command... 7 The polarplot() Command... 9 2D LINE PLOTS One of the benefits of programming in MATLAB
More information12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.
Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.
More informationMath Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs...
Introduction to Plotting with Matlab Math Sciences Computing Center University ofwashington September, 1996 Contents Fundamentals........................................... 1 Making Plots...........................................
More informationThe Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Chapter 7 Graphics Learning outcomes Label your plots Create different
More informationW1005 Intro to CS and Programming in MATLAB. Plo9ng & Visualiza?on. Fall 2014 Instructor: Ilia Vovsha. hgp://www.cs.columbia.
W1005 Intro to CS and Programming in MATLAB Plo9ng & Visualiza?on Fall 2014 Instructor: Ilia Vovsha hgp://www.cs.columbia.edu/~vovsha/w1005 Outline Plots (2D) Plot proper?es Figures Plots (3D) 2 2D Plots
More informationIntroduction to PartSim and Matlab
NDSU Introduction to PartSim and Matlab pg 1 PartSim: www.partsim.com Introduction to PartSim and Matlab PartSim is a free on-line circuit simulator that we use in Circuits and Electronics. It works fairly
More informationScientific Functions Complex Numbers
CNBC Matlab Mini-Course Inf and NaN 3/0 returns Inf David S. Touretzky October 2017 Day 2: More Stuff 0/0 returns NaN 3+Inf Inf/Inf 1 -Inf, -NaN 4 Scientific Functions Complex Numbers Trig: Rounding: Modular:
More informationGRAPHICS AND VISUALISATION WITH MATLAB
GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Des Ryan & Mike Griffiths September 2017 Topics 2D Graphics 3D Graphics Displaying Bit-Mapped Images Graphics with Matlab
More informationSpring 2010 Instructor: Michele Merler.
Spring 2010 Instructor: Michele Merler http://www1.cs.columbia.edu/~mmerler/comsw3101-2.html MATLAB does not use explicit type initialization like other languages Just assign some value to a variable name,
More informationMore on Plots. Dmitry Adamskiy 30 Nov 2011
More on Plots Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 3 Nov 211 1 plot3 (1) Recall that plot(x,y), plots vector Y versus vector X. plot3(x,y,z), where x, y and z are three vectors of the same length, plots
More informationObjectives. 1 Basic Calculations. 2 Matrix Algebra. Physical Sciences 12a Lab 0 Spring 2016
Physical Sciences 12a Lab 0 Spring 2016 Objectives This lab is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started in this class. It is meant to
More informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 4 Visualising Data Dr Richard Greenaway 4 Visualising Data 4.1 Simple Data Plotting You should now be familiar with the plot function which is
More informationBasic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures
Basic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures Matlab is flexible enough to let you quickly visualize data, and
More informationEOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson
EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson February 12, 2008 Getting help 1. Local On-line help (a) text-based help: >> help (b) GUI-help >> helpwin (c) Browser-based
More informationMATH 2221A Mathematics Laboratory II
MATH A Mathematics Laboratory II Lab Assignment 4 Name: Student ID.: In this assignment, you are asked to run MATLAB demos to see MATLAB at work. The color version of this assignment can be found in your
More informationAPPM 2460 PLOTTING IN MATLAB
APPM 2460 PLOTTING IN MATLAB. Introduction Matlab is great at crunching numbers, and one of the fundamental ways that we understand the output of this number-crunching is through visualization, or plots.
More informationLogical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.
What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical
More informationDATA PLOTTING WITH MATLAB
DATA PLOTTING WITH MATLAB Prof. Marco Pilotti marco.pilotti@ing.unibs.it Dr. Giulia Valerio giulia.valerio@ing.unibs.it Giulia Valerio 7Marzo 2014 1 1. WHY MATLAB? WHY MATLAB? Matlab is a high-level programming
More information1 >> Lecture 4 2 >> 3 >> -- Graphics 4 >> Zheng-Liang Lu 184 / 243
1 >> Lecture 4 >> 3 >> -- Graphics 4 >> Zheng-Liang Lu 184 / 43 Introduction ˆ Engineers use graphic techniques to make the information easier to understand. ˆ With graphs, it is easy to identify trends,
More informationFondamenti di Informatica Examples: Plotting 2013/06/13
Fondamenti di Informatica Examples: Plotting 2013/06/13 Prof. Emiliano Casalicchio emiliano.casalicchio@uniroma2.it Objectives This chapter presents the principles and practice of plotting in the following
More informationIntroductory Scientific Computing with Python
Introductory Scientific Computing with Python Introduction, IPython and Plotting FOSSEE Department of Aerospace Engineering IIT Bombay SciPy India, 2015 December, 2015 FOSSEE group (IIT Bombay) Interactive
More informationPlotting x-y (2D) and x, y, z (3D) graphs
Tutorial : 5 Date : 9/08/2016 Plotting x-y (2D) and x, y, z (3D) graphs Aim To learn to produce simple 2-Dimensional x-y and 3-Dimensional (x, y, z) graphs using SCILAB. Exercises: 1. Generate a 2D plot
More informationObjectives. 1 Running, and Interface Layout. 2 Toolboxes, Documentation and Tutorials. 3 Basic Calculations. PS 12a Laboratory 1 Spring 2014
PS 12a Laboratory 1 Spring 2014 Objectives This session is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started. Throughout the tutorial, the instructors
More informationIntroduction to Programming in MATLAB
Introduction to Programming in MATLAB User-defined Functions Functions look exactly like scripts, but for ONE difference Functions must have a function declaration Help file Function declaration Outputs
More informationIntroduction to MATLAB LAB 1
Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions
More informationCSE 123. Plots in MATLAB
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 the expression fun(x) over the default domain -2pi
More informationSGN Introduction to Matlab
SGN-84007 Introduction to Matlab Lecture 4: Data Visualization Heikki Huttunen Alessandro Foi October 10, 2016 Outline Basics: figure, axes, handles, properties; Plotting univariate and multivariate data;
More informationGraphics and plotting techniques
Davies: Computer Vision, 5 th edition, online materials Matlab Tutorial 5 1 Graphics and plotting techniques 1. Introduction The purpose of this tutorial is to outline the basics of graphics and plotting
More informationComputing Fundamentals Plotting
Computing Fundamentals Plotting Salvatore Filippone salvatore.filippone@uniroma2.it 2014 2015 (salvatore.filippone@uniroma2.it) Plotting 2014 2015 1 / 14 Plot function The basic function to plot something
More informationMath 7 Elementary Linear Algebra PLOTS and ROTATIONS
Spring 2007 PLOTTING LINE SEGMENTS Math 7 Elementary Linear Algebra PLOTS and ROTATIONS Example 1: Suppose you wish to use MatLab to plot a line segment connecting two points in the xy-plane. Recall that
More informationPlotting - Practice session
Plotting - Practice session Alessandro Fanfarillo - Salvatore Filippone fanfarillo@ing.uniroma2.it May 28th, 2013 (fanfarillo@ing.uniroma2.it) Plotting May 28th, 2013 1 / 14 Plot function The basic function
More informationPyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as
Geog 271 Geographic Data Analysis Fall 2015 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found
More informationBasic MATLAB Intro III
Basic MATLAB Intro III Plotting Here is a short example to carry out: >x=[0:.1:pi] >y1=sin(x); y2=sqrt(x); y3 = sin(x).*sqrt(x) >plot(x,y1); At this point, you should see a graph of sine. (If not, go to
More informationCCNY. BME 2200: BME Biostatistics and Research Methods. Lecture 4: Graphing data with MATLAB
BME 2200: BME Biostatistics and Research Methods Lecture 4: Graphing data with MATLAB Lucas C. Parra Biomedical Engineering Department CCNY parra@ccny.cuny.edu 1 Content, Schedule 1. Scientific literature:
More informationENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots
ENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots ENGG1811 UNSW, CRICOS Provider No: 00098G1 W11 slide 1 More on plotting Matlab has a lot of plotting features Won t go through them
More informationIntroduction to MATLAB
58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help
More informationWhat is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations
What is MATLAB? It stands for MATrix LABoratory It is developed by The Mathworks, Inc (http://www.mathworks.com) It is an interactive, integrated, environment for numerical computations for symbolic computations
More informationTOPIC 6 Computer application for drawing 2D Graph
YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 6 Computer application for drawing 2D Graph Plotting Elementary Functions Suppose we wish
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationGraphics in MATLAB. Responsible teacher: Anatoliy Malyarenko. November 10, Abstract. Basic Plotting Commands
Graphics in MATLAB Responsible teacher: Anatoliy Malyarenko November 10, 2003 Contents of the lecture: Two-dimensional graphics. Formatting graphs. Three-dimensional graphics. Specialised plots. Abstract
More informationMATLAB Guide to Fibonacci Numbers
MATLAB Guide to Fibonacci Numbers and the Golden Ratio A Simplified Approach Peter I. Kattan Petra Books www.petrabooks.com Peter I. Kattan, PhD Correspondence about this book may be sent to the author
More informationDepartment of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb
Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial Vb Making Plots with Matlab (last updated 5/29/05 by GGB) Objectives: These tutorials are
More informationName: Math Analytic Geometry and Calculus III - Spring Matlab Project - due on Wednesday, March 30
Name: Math 275 - Analytic Geometry and Calculus III - Spring 2011 Solve the following problems: Matlab Project - due on Wednesday, March 30 (Section 14.1 # 30) Use Matlab to graph the curve given by the
More informationMATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)
Digital Signal Processing Prof. Nizamettin AYDIN naydin@yildiz.edu.tr naydin@ieee.org http://www.yildiz.edu.tr/~naydin Course Details Course Code : 0113620 Course Name: Digital Signal Processing (Sayısal
More informationMatlab Examples. (v.01, Fall 2011, Ex prepared by HP Huang; Ex prepared by Noel Baker)
1 Matlab Examples (v.01, Fall 2011, Ex. 1-50 prepared by HP Huang; Ex 51-55 prepared by Noel Baker) These examples illustrate the uses of the basic commands that will be discussed in the Matlab tutorials.
More informationThis module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in
This module aims to introduce Precalculus high school students to the basic capabilities of Matlab by using functions. Matlab will be used in subsequent modules to help to teach research related concepts
More informationPyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as
Geog 271 Geographic Data Analysis Fall 2017 PyPlot Graphicscanbeproducedin Pythonviaavarietyofpackages. We willuseapythonplotting package that is part of MatPlotLib, for which documentation can be found
More informationDr. Iyad Jafar. Adapted from the publisher slides
Computer Applications Lab Lab 6 Plotting Chapter 5 Sections 1,2,3,8 Dr. Iyad Jafar Adapted from the publisher slides Outline xy Plotting Functions Subplots Special Plot Types Three-Dimensional Plotting
More informationSolving Simultaneous Nonlinear Equations. SELİS ÖNEL, PhD
Solving Simultaneous Nonlinear Equations SELİS ÖNEL, PhD Quotes of the Day Nothing in the world can take the place of Persistence. Talent will not; nothing is more common than unsuccessful men with talent.
More informationLab 6: Graphical Methods
Lab 6: Graphical Methods 6.1 Introduction EGR 53L - Fall 2009 Lab this week is going to introduce graphical solution and presentation techniques as well as surface plots. 6.2 Resources The additional resources
More informationInteractive Computing with Matlab. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University
Interactive Computing with Matlab Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu Starting Matlab Double click on the Matlab icon, or on unix systems
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Engineering Faculty Department of Mechanical Engineering Arrays in MATLAB; Vectors and Matrices Graphing Vector Generation Before graphing plots in
More informationPSY8219 : Week 2. Homework 1 Due Today. Homework 2 Due September 12. Readings for Today Attaway Chapters 2, 7, and 8
PSY8219 : Week 2 Homework 1 Due Today (homework solutions will be posted on the web site after class the day the assignment is due or two+ days after if anyone is late turning it in) Homework 2 Due September
More informationMATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting
MATLAB Laboratory 09/23/10 Lecture Chapters 5 and 9: Plotting Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu L. Oberbroeckling (Loyola University) MATLAB 09/23/10 Lecture
More informationLecturer: Keyvan Dehmamy
MATLAB Tutorial Lecturer: Keyvan Dehmamy 1 Topics Introduction Running MATLAB and MATLAB Environment Getting help Variables Vectors, Matrices, and linear Algebra Mathematical Functions and Applications
More informationAMS 27L LAB #2 Winter 2009
AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles
More informationMatlab programming, plotting and data handling
Matlab programming, plotting and data handling Andreas C. Kapourani (Credit: Steve Renals & Iain Murray) 25 January 27 Introduction In this lab session, we will continue with some more sophisticated matrix
More information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationIntroduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003
Introduction to MATLAB Computational Probability and Statistics CIS 2033 Section 003 About MATLAB MATLAB (MATrix LABoratory) is a high level language made for: Numerical Computation (Technical computing)
More informationINTRODUCTORY NOTES ON MATLAB
INTRODUCTORY NOTES ON MATLAB C Lamas Fernández, S Marelli, B Sudret CHAIR OF RISK, SAFETY AND UNCERTAINTY QUANTIFICATION STEFANO-FRANSCINI-PLATZ 5 CH-8093 ZÜRICH Risk, Safety & Uncertainty Quantification
More informationMatlab Practice Sessions
Matlab Practice Sessions 1. Getting Started Startup Matlab Observe the following elements of the desktop; Command Window Current Folder Window Command History Window Workspace Window Notes: If you startup
More informationQUICK INTRODUCTION TO MATLAB PART I
QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have
More informationLecture 3 for Math 398 Section 952: Graphics in Matlab
Lecture 3 for Math 398 Section 952: Graphics in Matlab Thomas Shores Department of Math/Stat University of Nebraska Fall 2002 A good deal of this material comes from the text by Desmond Higman and Nicholas
More informationIntroduction to MATLAB Step by Step Exercise
Large list of exercise: start doing now! 1 35: Basic (variables, GUI, command window, basic plot, for, if, functions) 36 40: Medium (functions) 41 45: Medium (matrices) 46 51: Medium (plot) 52 55: Medium
More informationMATLAB Quick Reference
MATLAB Quick Reference Operators Matrix Operations Array or Element by Element + Addition - Subtraction * Matrix Multiplication.* Element by Element Multiplication / Right Matrix Division b/ A=bA 1./ Element
More informationA very brief Matlab introduction
A very brief Matlab introduction Siniša Krajnović January 24, 2006 This is a very brief introduction to Matlab and its purpose is only to introduce students of the CFD course into Matlab. After reading
More information( you can also use "contourf" instead of "contour" for filled colors )
Assignment 3 Due: October 23 5pm 1. Two Dimensional Example. For the 2-D temperature field given by,, a) Evaluate the gradient,,. (do not use the "gradient" function in Matlab) b) Visualization 1: Surface
More informationMatLab Programming Lesson 3
MatLab Programming Lesson 3 1) Log into your computer and open MatLab 2) If you don t have the previous M-scripts saved, you can find them at http://www.physics.arizona.edu/~physreu/dox/matlab_lesson_1.pdf,
More informationCDA6530: Performance Models of Computers and Networks. Chapter 4: Using Matlab for Performance Analysis and Simulation
CDA6530: Performance Models of Computers and Networks Chapter 4: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted
More informationGetting Started with MATLAB
Getting Started with MATLAB Math 315, Fall 2003 Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such as
More informationEng Marine Production Management. Introduction to Matlab
Eng. 4061 Marine Production Management Introduction to Matlab What is Matlab? Matlab is a commercial "Matrix Laboratory" package which operates as an interactive programming environment. Matlab is available
More informationMATLAB PROGRAMMING LECTURES. By Sarah Hussein
MATLAB PROGRAMMING LECTURES By Sarah Hussein Lecture 1: Introduction to MATLAB 1.1Introduction MATLAB is a mathematical and graphical software package with numerical, graphical, and programming capabilities.
More informationPage 1 of 7 E7 Spring 2009 Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Department of Civil and Environmental Engineering. Practice Midterm 01
Page 1 of E Spring Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Practice Midterm 1 minutes pts Question Points Grade 1 4 3 6 4 16 6 1 Total Notes (a) Write your name and your SID on the top right
More informationIntroduction in MATLAB (TSRT04)
VT2 2019 Division of Communication Systems Department of Electrical Engineering (ISY) Linköping University, Sweden www.commsys.isy.liu.se/en/student/kurser/tsrt04 About the Course MATLAB Basics Vectors
More informationLab 5: Matlab Tutorial Due Sunday, May 8 at midnight
Lab 5: Matlab Tutorial Due Sunday, May 8 at midnight For this final lab, you should work with a partner. You know how to do that at this point. Only one partner turns in the lab, but both of your names
More informationPHS3XXX Computational Physics
1 PHS3XXX Computational Physics Lecturer: Mike Wheatland michael.wheatland@sydney.edu.au Lecture and lab schedule (SNH Learning Studio 4003) 1 There are 10 weeks of lectures and labs Lectures: Mon 9am
More informationCDA5530: Performance Models of Computers and Networks. Chapter 8: Using Matlab for Performance Analysis and Simulation
CDA5530: Performance Models of Computers and Networks Chapter 8: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted
More informationLab #1 Revision to MATLAB
Lab #1 Revision to MATLAB Objectives In this lab we would have a revision to MATLAB, especially the basic commands you have dealt with in analog control. 1. What Is MATLAB? MATLAB is a high-performance
More informationMATLAB Functions and Graphics
Functions and Graphics We continue our brief overview of by looking at some other areas: Functions: built-in and user defined Using M-files to store and execute statements and functions A brief overview
More informationECE 201 Matlab Lesson #2 Basic Arithmetic and Plotting. Element-by-Element Arithmetic for Vectors and Matrices
ECE 201 Matlab Lesson #2 Basic Arithmetic and Plotting Element-by-Element Arithmetic for Vectors and Matrices A+B A-B A.*B A./B A.\B A.^B A.' MATLAB has two different types of arithmetic operations. Matrix
More informationGUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot
MATLAB Function Reference plot 2-D line plot GUI Alternatives Use the Plot Selector to graph selected variables in the Workspace Browser and the Plot Catalog, accessed from the Figure Palette. Directly
More informationA Quick Guide to MATLAB
Appendix C A Quick Guide to MATLAB In this course we will be using the software package MATLAB. The most recent version can be purchased directly from the MATLAB web site: http://www.mathworks.com/academia/student
More informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationGetting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text
Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go
More information