MATLAB & Practical Application on Climate Variability Studies EXERCISES

Size: px
Start display at page:

Download "MATLAB & Practical Application on Climate Variability Studies EXERCISES"

Transcription

1 B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera & Department of Atmospheric and Oceanic Sciences (UBA) DAY2 Exercise n. 5 Aim: Read nino3 SSTA series in binary format, plot and save the image. Data:..esercizi\day_1/ex2/output/ssta_nino3_30y.dat Solution: Exe-5.m cd C:\ENRICO\tutorials\esercizi\day_2\ex5; fid=fopen('../../day_1/ex2/output/ssta_nino3_30y.dat'... %... Continue on the next line,'r','b'); % Read nino3 ssta 30y time series ssta_series=fread(fid,'float32'); % in binary format stored % at the end of the exe-2. close(fid); % Close the file. plot(ssta_series); grid on; settings=get(gca) % Struct array of axes properties. %look and change some values: set(gca,'xlim',[0 360]); % Set limits, set(gca,'ylim',[ ]); % set(gca,'xtick',[0:12.*4:360]); % Ticks and set(gca,'xticklabel',[1970:1.*4:2000]); % tick labels step: 4y. line([0 360],[0 0],'color','r') tit=title('nino3 SSTA 30 y','fontweight','bold'); get(tit) ylabel('[ ^oc ]'); xlabel('[ years ]'); ssta_series_smooth=runavg(ssta_series,5); hold on; plot(ssta_series_smooth,'k'); print -djpeg90./output/ssta_series_30y.jpg % Plot zero line. % Title. % Get title properties. % Set axes labels. % Smooth the series with 3 months % window. % Hold previous plots on figure. % Plot the smoothed series on the % same graphic. % Print out the figure in % jpeg format. 1

2 Exercise n. 6 Aim: Vectorizing loops: 6a. vectorizing a double FOR loop. 6b. vectorizing code that finds the cumulative sum of a vector every fifth element. (need cumsum function) 6c. Create a code that repeats a vector value when the following value is 0. Data: No data. Solutions: Exe-6a.m A = magic(100); % Create 2 matrices 100x100 B = pascal(100); % tic for j = 1:100 for k = 1:100; X(j,k) = sqrt(a(j,k)) * (B(j,k) - 1); end end toc % Elapsed time is seconds. % Start stopwatch timer. % L % O % O % P % to vectorize % Stop stopwatch timer. %%%%%%%%%%%% SOLUTION %%%%%%%%%%%%% X tic % Start stopwatch timer. X = sqrt(a).*(b-1); % Vectorized loop. toc % Stop stopwatch timer. % Elapsed time is seconds. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2

3 Exe-6b.m x = 1:10000; y = []; tic for n = 5:5:length(x) y = [y sum(x(1:n))]; end toc % Elapsed time is seconds. % Create a vector. % Start stopwatch timer. % LOOP % to vectorize. % Stop stopwatch timer. %%%%%%%%%%%% SOLUTION %%%%%%%%%%%%% tic % Start stopwatch timer. cums = cumsum(x); % Vectorized y = cums(5:5:length(x)); % loop. toc % Stop stopwatch timer. % Elapsed time is seconds. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3

4 Exe-6c.m a=2; b=3; c=5; d=15; e=11; x = [a b 0 0 c d 0 e ]; % and convert x in % x = [a a a a b b b c c c c c d d e e e e e e]; % Create a vector. %%%%%%%%%%% SOLUTION 1 %%%%%%%%%%%% aa=find(x==a); bb=find(x==b); cc=find(x==c); dd=find(x==d); ee=find(x==e); x(aa:bb-1)=a; x(bb:cc-1)=b; x(cc:dd-1)=c; x(dd:ee-1)=d; x(dd:end)=e; % x = % a a a a b b b c c c c c d d e e e e e e %%%%%%%%%% END SOLUTION 1 %%%%%%%%%% follow a 2 nd solution %%%%%%%%%%%% SOLUTION 2 %%%%%%%%%%%% x = [a b 0 0 c d 0 e ]; % Create a vector. valind = find(x); % valind = > indexes % x = x(valind(2:end)) = diff(x(valind)); %diff(x(valind)) is [ ] % x = x = cumsum(x); % x = % a a a a b b b c c c c c d d e e e e e e %%%%%%%%%% END SOLUTION 2 %%%%%%%%%% % N.B. Despite the high vectorization of the 2nd solution, % the performance is lower! % Verify with TIC and TOC functions or PROFILE function. 4

5 Exercise n. 7 Aim: Read an SST field and plot global mapping in different projections. (starting from the Exe 3 [day 1]) Data:..esercizi\day_1\data\skt.mon.mean.nc.. esercizi\day_1\data\lsmask nc Solution: Exe-7.m %%% part of Exe-3 %%% ncload../../day_1/data/skt.mon.mean.nc ncload../../day_1/data/lsmask nc pcolor(flipud(lsmask));colorbar; lsm=lsmask+1; lsm(lsm==0)=nan; skt_y1=squeeze(mean(skt(1:12,:,:))); lsmask skt sst_y1=skt_y1.*lsm; figure; pcolor(flipud(sst_y1)); %%% end part of Exe-3 %%% %%% Geo-referencing... [x,y]=meshgrid(lon,lat); figure axesm(... 'MapProjection','eqdcylin',... 'MapLatLimit',[-90 90],... 'Maplonlimit',[ ],... 'parallellabel','on',... 'meridianlabel','on',... 'labelformat','compass',... 'grid','on',... 'fontsize',8,... 'mlabelparallel','south',... 'origin',[ ]); % Load skin temperature % field time series and % land-sea mask. % view the mask field % N.B. not geo-referenced. % Set "1" on the sea and "nan" on the land. % 94x192 % Subsample the T time series in time: % get the first year of mm. % 94x192 % 94x192 % Create figure windows. % View the sst field created masking % the skin temperature annual field % (skt_y1). % N.B. not geo-referenced. % Used for the evaluation % of functions of two variables % Create a new map axes/ % define a map projection. pcolorm(y,x,sst_y1); % Projected matrix map. tightmap % Removes whitespace around % the map. 5

6 caxis([-32 32]); colorbar('horizon'); [c,h]=contourm(y,x,sst_y1,[-32:4:32],'k'); ht=clabelm(c,h,'fontsize',8,'fontweight','bold'); tit=title('sst year 1','fontweight','bold'); % Set color axis. % Contouring. % Title. exercise 7. % PLOT THE FIELD IN ORTOGRAPHIC PROJECTION: figure ax=axesm(... 'MapProjection','ortho',... 'parallellabel','on',... 'meridianlabel','on',... 'MapLatLimit',[-20-90],... 'Maplonlimit',[ ],... 'flatlimit',[-inf 70],... 'labelformat','compass',... 'grid','on',... 'origin',[ ],... 'fontsize',8); framem on; pcolorm(y,x,sst_y1); % tightmap caxis([-32 32]); colorbar('horizon'); [c,h]=contourm(y,x,sst_y1,[-32:4:32],'k'); ht=clabelm(c,h,'fontsize',8,'fontweight','bold'); tit=title('sst year 1','fontsize',12,'fontweight','bold'); % FILL THE WHITE SECTOR AND MASK THE LAND: lon(end)=lon(1); [x,y]=meshgrid(lon,lat); figure ax=axesm(... 'MapProjection','ortho',... 'parallellabel','on',... 'meridianlabel','on',... 'MapLatLimit',[-20-90],... 'Maplonlimit',[ ],... 'flatlimit',[-inf 70],... 'labelformat','compass',... 'grid','on',... 'origin',[ ],... 'fontsize',8); framem on; pcolorm(y,x,sst_y1); tightmap caxis([-32 32]); colorbar('horizon'); [c,h]=contourm(y,x,sst_y1,[-32:4:32],'k'); ht=clabelm(c,h,'fontsize',8,'fontweight','bold'); tit=title('sst year 1','fontsize',12,'fontweight','bold'); load coast; patchm(lat,long,[ ]); % Close the boundaries. % Load coast values. % Mask the land. (graphic mask) 6

7 Exercise n. 8 Aim: Create Scatter Plots. Some info about subplotting and page layout settings. Data:..esercizi\day_1\data\h_scatter.mat..esercizi\day_1\ data\ctrl_h_shear_ts_pdi.mat Solution: Exe-8.m load../../day_1/data/h_scatter load../../day_1/data/ctrl_h_shear_ts_pdi % >> whos *atl* % Name Size Bytes Class % % pdi_atl 1x double array % shear_atl 1x double array % temp_atl 1x double array % % Load a pre-built colormap. % % >> whos *wnp* % Name Size Bytes Class % % pdi_wnp 1x double array % shear_wnp 1x double array % temp_wnp 1x double array a4 subplot(2,1,1) scatter(temp_atl,shear_atl,10,pdi_atl); caxis([0 8e+9]); colormap(h_scatter); set(gca,'ylim',[0 22],'xlim',[26 34]); title(' ATL T eye value & local shear',... 'fontweight','bold');grid on; %xlabel('t surface [^o C]'); ylabel('wind shear [m/s]'); % Set figure dimensions. % Subplot 1 of 2 in the figure. % Scatter plot. (10 is the area % of each marker). % Set color axis % Use the pre-built colormap. % Set plot limits. subplot(2,1,2) scatter(temp_wnp,shear_wnp,10,pdi_wnp); caxis([0 8e+9]) colormap(h_scatter) set(gca,'ylim',[0 22],'xlim',[26 34]); xlabel('t surface [^o C]');ylabel('wind shear [m/s]'); title(' WNP T eye value & local shear',... 'fontweight','bold');grid on; 7

8 % Create a new subplot outside the figure, to get only the colorbar. subplot('position',[ ]);scatter(temp_wnp,shear_wnp,10,pdi_wnp); caxis([0 8e+9]) colormap(h_scatter) h=colorbar('horiz'); set(h,'position',[ ]); print -djpeg./output/scatter_ctrl_atl_wnp.jpg % Positioning the colorbar % between the two subplots. exercise 8. 8

MATLAB & Practical Application on Climate Variability Studies EXERCISES

MATLAB & Practical Application on Climate Variability Studies EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera & Department of Atmospheric and Oceanic Sciences (UBA) DAY1 Exercise n. 1 Read an SST field in netcdf format, subsample and save

More information

MATLAB & Practical Application on Climate Variability Studies EXERCISES

MATLAB & Practical Application on Climate Variability Studies EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera & Department of Atmospheric and Oceanic Sciences (UBA) DAY3 Exercise n. 9 Aim: Compute Mean, Standard Deviation for U wind component

More information

MATLAB & Practical Applications on Climate Variability Studies tutorial

MATLAB & Practical Applications on Climate Variability Studies tutorial MATLAB & Practical Applications on Climate Variability Studies tutorial B.Aires, 20-24/02/06 Centro de Investigaciones del Mar y la Atmosfera & Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro,

More information

MATLAB & Practical Application on Climate Variability Studies EXERCISES

MATLAB & Practical Application on Climate Variability Studies EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera Department of Atmospheric and Oceanic Sciences (UBA) DAY4 Exercise n. 14 Aim: S-EXTRATROPICAL EOFs & Saving in netcdf format. Data:..esercizi\day_3\

More information

CCNY. BME 2200: BME Biostatistics and Research Methods. Lecture 4: Graphing data with MATLAB

CCNY. 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 information

Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.

Logical 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 information

Stokes Modelling Workshop

Stokes Modelling Workshop Stokes Modelling Workshop 14/06/2016 Introduction to Matlab www.maths.nuigalway.ie/modellingworkshop16/files 14/06/2016 Stokes Modelling Workshop Introduction to Matlab 1 / 16 Matlab As part of this crash

More information

Introduction to MATLAB

Introduction 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 information

Plotting using Matlab. Vytautas Astromskas

Plotting using Matlab. Vytautas Astromskas Plotting using Matlab Vytautas Astromskas Contents 1 Manipulating a plot using GUI 2 2 Manipulating a plot using command line 4 3 Adding multiple lines to the same plot 5 4 Logarithmic axes 6 5 Plotting

More information

MATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.

MATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix. MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,

More information

Appendix A.2 Matlab Rectification of Video Images. OTHER View Matlab Script for Rectifying Images and Corresponding Image Outputs

Appendix A.2 Matlab Rectification of Video Images. OTHER View Matlab Script for Rectifying Images and Corresponding Image Outputs Appendix A.2 Matlab Rectification of Video Images OTHER View Matlab Script for Rectifying Images and Corresponding Image Outputs % Change working directory to directory with files clear all % Clear workspace

More information

Basic 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 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 information

Scientific Python: matplotlib

Scientific Python: matplotlib Scientific Python: matplotlib 17 July 2014 Introduction and Aims This exercise introduces the matplotlib module of Python. Matplotlib is a versatile plotting library that can be used to produce both quick

More information

Introduction to CS graphs and plots in Excel Jacek Wiślicki, Laurent Babout,

Introduction to CS graphs and plots in Excel Jacek Wiślicki, Laurent Babout, MS Excel 2010 offers a large set of graphs and plots for data visualization. For those who are familiar with older version of Excel, the layout is completely different. The following exercises demonstrate

More information

Octave Tutorial Machine Learning WS 12/13 Umer Khan Information Systems and Machine Learning Lab (ISMLL) University of Hildesheim, Germany

Octave Tutorial Machine Learning WS 12/13 Umer Khan Information Systems and Machine Learning Lab (ISMLL) University of Hildesheim, Germany Octave Tutorial Machine Learning WS 12/13 Umer Khan Information Systems and Machine Learning Lab (ISMLL) University of Hildesheim, Germany 1 Basic Commands Try Elementary arithmetic operations: 5+6, 3-2,

More information

Section 2-2. Histograms, frequency polygons and ogives. Friday, January 25, 13

Section 2-2. Histograms, frequency polygons and ogives. Friday, January 25, 13 Section 2-2 Histograms, frequency polygons and ogives 1 Histograms 2 Histograms The histogram is a graph that displays the data by using contiguous vertical bars of various heights to represent the frequencies

More information

DATA PLOTTING WITH MATLAB

DATA 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 information

6 Further... Programming

6 Further... Programming 6 Further... Programming In this chapter we ll get some (more) practice building programs and crafting (often) bite-sized chunks of code that solve a specific, normally computational or numerical (rather

More information

Introduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices

Introduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are

More information

GUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot

GUI 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 information

Introduction to MATLAB

Introduction 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 information

Python Development Technical Note 4

Python Development Technical Note 4 Python Development Technical Note 4 Peter Higgins, October 1, 2018 Introduction Programmed data analysis, and resultant presentation graphics (especially done by me) needs to be accomplished without using

More information

EOSC 473/573 Matlab Tutorial R. Pawlowicz with changes by M. Halverson

EOSC 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 information

ENGR Fall Exam 1

ENGR Fall Exam 1 ENGR 1300 Fall 01 Exam 1 INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions. Read carefully..

More information

INTERNATIONAL EDITION. MATLAB for Engineers. Third Edition. Holly Moore

INTERNATIONAL EDITION. MATLAB for Engineers. Third Edition. Holly Moore INTERNATIONAL EDITION MATLAB for Engineers Third Edition Holly Moore 5.4 Three-Dimensional Plotting Figure 5.8 Simple mesh created with a single two-dimensional matrix. 5 5 Element,5 5 The code mesh(z)

More information

Mini-Project System Simulation over AWGN Using BPSK Modulation

Mini-Project System Simulation over AWGN Using BPSK Modulation Mini-Project System Simulation over AWGN Using BPSK Modulation Part I: MATLAB Environment Due Date: June 5, 2006. This exercise will guide you to realize the basic operating environment. Some useful instructions

More information

Overview. Linear Algebra Notation. MATLAB Data Types Data Visualization. Probability Review Exercises. Asymptotics (Big-O) Review

Overview. Linear Algebra Notation. MATLAB Data Types Data Visualization. Probability Review Exercises. Asymptotics (Big-O) Review Tutorial 1 1 / 21 Overview Linear Algebra Notation Data Types Data Visualization Probability Review Exercises Asymptotics (Big-O) Review 2 / 21 Linear Algebra Notation Notation and Convention 3 / 21 Linear

More information

Directional Tuning in Single Unit Activity from the Monkey Motor Cortex

Directional Tuning in Single Unit Activity from the Monkey Motor Cortex Teaching Week Computational Neuroscience, Mind and Brain, 2011 Directional Tuning in Single Unit Activity from the Monkey Motor Cortex Martin Nawrot 1 and Alexa Riehle 2 Theoretical Neuroscience and Neuroinformatics,

More information

ENGR Fall Exam 1 PRACTICE EXAM

ENGR Fall Exam 1 PRACTICE EXAM ENGR 13100 Fall 2012 Exam 1 PRACTICE EXAM INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions.

More information

Introduzione a MatLab. Prof. Sebastiano Battiato

Introduzione a MatLab. Prof. Sebastiano Battiato Introduzione a MatLab Prof. Sebastiano Battiato MatLab Environment MATLAB Matlab = Matrix Laboratory Originally a user interface for numerical linear algebra routines (Lapak/Linpak) Commercialized 1984

More information

Introduction to Programming in MATLAB

Introduction 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 information

INC151 Electrical Engineering Software Practice. MATLAB Graphics. Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1

INC151 Electrical Engineering Software Practice. MATLAB Graphics. Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1 INC151 Electrical Engineering Software Practice MATLAB Graphics Dr.Wanchak Lenwari :Control System and Instrumentation Engineering, KMUTT 1 Graphical display is one of MATLAB s greatest strengths and most

More information

Lab 6: Graphical Methods

Lab 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 information

EGR 102 Introduction to Engineering Modeling. Lab 05B Plotting

EGR 102 Introduction to Engineering Modeling. Lab 05B Plotting EGR 102 Introduction to Engineering Modeling Lab 05B Plotting 1 Overview Plotting in MATLAB 2D plotting ( ezplot(), fplot(), plot()) Formatting of 2D plots 3D plotting (surf(), mesh(), plot3()) Formatting

More information

ELEC6021 Research Methods Matlab Session 2

ELEC6021 Research Methods Matlab Session 2 ELEC6021 Research Methods Matlab Session 2 In the first session, we looked at how to write our own Matlab functions, among other things. This session poses a number of problems and asks you to write Matlab

More information

3 Selecting the standard map and area of interest

3 Selecting the standard map and area of interest Anomalies, EOF/PCA Mati Kahru 2005-2008 1 Anomalies, EOF/PC analysis with WAM 1 Introduction Calculating anomalies is a method of change detection in time series. Empirical Orthogonal Function (EOF) analysis

More information

Plotting x-y (2D) and x, y, z (3D) graphs

Plotting 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 information

A very brief Matlab introduction

A 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

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.

More information

What is Matlab? A software environment for interactive numerical computations

What is Matlab? A software environment for interactive numerical computations What is Matlab? A software environment for interactive numerical computations Examples: Matrix computations and linear algebra Solving nonlinear equations Numerical solution of differential equations Mathematical

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Contact Email: enrique.munoz@unimi.it Office: Room BT-43 Industrial,

More information

Temperature Patterns: Functions and Line Graphs

Temperature Patterns: Functions and Line Graphs activity 3.1 Temperature Patterns: Functions and Line Graphs In this activity, you will work with examples in which curves obtained by joining known points of the graph of a function can help you understand

More information

Introduction to MATLAB

Introduction to MATLAB Quick Start Tutorial Introduction to MATLAB Hans-Petter Halvorsen, M.Sc. What is MATLAB? MATLAB is a tool for technical computing, computation and visualization in an integrated environment. MATLAB is

More information

Graphics in MATLAB. Responsible teacher: Anatoliy Malyarenko. November 10, Abstract. Basic Plotting Commands

Graphics 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 information

Information for Candidates. Test Format

Information for Candidates. Test Format Information for Candidates Test Format The MathWorks Certified MATLAB Professional (MCMP) exam consists of two sections: 25 multiplechoice questions and 8 performance-based problems. MATLAB access is not

More information

Basic MATLAB Intro III

Basic 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 information

Lecture 7. MATLAB and Numerical Analysis (4)

Lecture 7. MATLAB and Numerical Analysis (4) Lecture 7 MATLAB and Numerical Analysis (4) Topics for the last 2 weeks (Based on your feedback) PDEs How to email results (after FFT Analysis (1D/2D) Advanced Read/Write Solve more problems Plotting3Dscatter

More information

An Introduction to MATLAB II

An Introduction to MATLAB II Lab of COMP 319 An Introduction to MATLAB II Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 2: 16th Sep, 2013 1 Outline of Lab 2 Review of Lab 1 Matrix in Matlab

More information

Lecture 2: Advanced Programming Topics

Lecture 2: Advanced Programming Topics Lecture 2: Advanced Programming Topics Characters and Strings A character in the MATLAB software is actually an integer value converted to its Unicode character equivalent. A character string is a vector

More information

Ecffient calculations

Ecffient calculations Ecffient calculations Vectorized computations The efficiency of calculations depends on how you perform them. Vectorized calculations, for example, avoid going trough individual vector or matrix elements

More information

matlab_intro.html Page 1 of 5 Date: Tuesday, September 6, 2005

matlab_intro.html Page 1 of 5 Date: Tuesday, September 6, 2005 matlab_intro.html Page 1 of 5 % Introducing Matlab % adapted from Eero Simoncelli (http://www.cns.nyu.edu/~eero) % and Hany Farid (http://www.cs.dartmouth.edu/~farid) % and Serge Belongie (http://www-cse.ucsd.edu/~sjb)

More information

16.7 OC680 Assignment 6, Due Wednesday Feb. 28

16.7 OC680 Assignment 6, Due Wednesday Feb. 28 292 CHAPTER 16. NOTES Figure 16.30: Profiles of (a) velocity and (b) shear for the separating boundary layer. 16.7 OC680 Assignment 6, Due Wednesday Feb. 28 1: Instability of a separating boundary layer

More information

Exercises with Level-2 satellite data

Exercises with Level-2 satellite data Exercises with Level-2 satellite data Mati Kahru WimSoft, http://www.wimsoft.com Email: wim@wimsoft.com & Scripps Institution of Oceanography UCSD, La Jolla, CA 92093-0218, USA mkahru@ucsd.edu 24-Jan-15

More information

MATH 2221A Mathematics Laboratory II

MATH 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 information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab The purpose of this intro is to show some of Matlab s basic capabilities. Nir Gavish, 2.07 Contents Getting help Matlab development enviroment Variable definitions Mathematical operations

More information

Lab of COMP 406 Introduction of Matlab (II) Graphics and Visualization

Lab 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 information

PASS Sample Size Software

PASS Sample Size Software Chapter 941 Introduction In PASS, it is easy to study power and sample size calculations for a range of possible parameter values. When at least 2 input parameters vary, you can create stunning 3D power

More information

Matlab Practice Sessions

Matlab 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 information

C =

C = file:///c:/documents20and20settings/ravindra/desktop/html/exercis... 1 of 5 10/3/2008 3:17 PM Lab Exercise 2 - Matrices Hyd 510L, Fall, 2008, NM Tech Programmed by J.L. Wilson, Sept, 2008 Problem 2.1 Create

More information

Spring 2010 Instructor: Michele Merler.

Spring 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 information

Introduction to Matlab

Introduction 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 information

Data Mining: Exploring Data. Lecture Notes for Chapter 3

Data Mining: Exploring Data. Lecture Notes for Chapter 3 Data Mining: Exploring Data Lecture Notes for Chapter 3 1 What is data exploration? A preliminary exploration of the data to better understand its characteristics. Key motivations of data exploration include

More information

ČVUT v Praze in Prague. Introduction to MATLAB

ČVUT v Praze in Prague. Introduction to MATLAB Introduction to MATLAB 1 Matlab Usage Signal processing, image processing, testing and measurement, financial modelling and analysis, computational biology, Expansions of MATLAB Toolboxes for specific

More information

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as

PyPlot. 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 information

Worksheet 1. Hello Matlab

Worksheet 1. Hello Matlab Worksheet 1. Hello Matlab This worksheet gives a quick introduction to Matlab. Start Matlab from the START - PROGRAMS - MATLAB6.5 - MATLAB6.5 menu. You should now be faced by a terminal window awaiting

More information

! The MATLAB language

! The MATLAB language E2.5 Signals & Systems Introduction to MATLAB! MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to -use environment. Typical

More information

INTRODUCTION TO MATLAB PLOTTING WITH MATLAB

INTRODUCTION 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 information

Mechanical Engineering Department Second Year (2015)

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 information

Matlab Lecture 1 - Introduction to MATLAB. Five Parts of Matlab. Entering Matrices (2) - Method 1:Direct entry. Entering Matrices (1) - Magic Square

Matlab Lecture 1 - Introduction to MATLAB. Five Parts of Matlab. Entering Matrices (2) - Method 1:Direct entry. Entering Matrices (1) - Magic Square Matlab Lecture 1 - Introduction to MATLAB Five Parts of Matlab MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-touse

More information

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Introduction to Data Mining

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Introduction to Data Mining Data Mining: Exploring Data Lecture Notes for Chapter 3 Introduction to Data Mining by Tan, Steinbach, Kumar What is data exploration? A preliminary exploration of the data to better understand its characteristics.

More information

Visualisation in python (with Matplotlib)

Visualisation in python (with Matplotlib) Visualisation in python (with Matplotlib) Thanks to all contributors: Ag Stephens, Stephen Pascoe. Introducing Matplotlib Matplotlib is a python 2D plotting library which produces publication quality figures

More information

Chapter 11. Above: Principal contraction rates calculated from GPS velocities. Visualized using MATLAB.

Chapter 11. Above: Principal contraction rates calculated from GPS velocities. Visualized using MATLAB. Chapter 11 Above: Principal contraction rates calculated from GPS velocities. Visualized using MATLAB. We have used MATLAB to visualize data a lot in this course, but we have only scratched the surface

More information

Data Mining: Exploring Data. Lecture Notes for Data Exploration Chapter. Introduction to Data Mining

Data Mining: Exploring Data. Lecture Notes for Data Exploration Chapter. Introduction to Data Mining Data Mining: Exploring Data Lecture Notes for Data Exploration Chapter Introduction to Data Mining by Tan, Steinbach, Karpatne, Kumar 02/03/2018 Introduction to Data Mining 1 What is data exploration?

More information

Classes 7-8 (4 hours). Graphics in Matlab.

Classes 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 information

Matlab Tutorial 1: Working with variables, arrays, and plotting

Matlab Tutorial 1: Working with variables, arrays, and plotting Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.

More information

Data Mining: Exploring Data. Lecture Notes for Chapter 3

Data Mining: Exploring Data. Lecture Notes for Chapter 3 Data Mining: Exploring Data Lecture Notes for Chapter 3 Slides by Tan, Steinbach, Kumar adapted by Michael Hahsler Look for accompanying R code on the course web site. Topics Exploratory Data Analysis

More information

Introduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003

Introduction 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 information

Introduction to MATLAB

Introduction 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 information

Introduction to Matlab

Introduction 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 information

Data needs to be prepped for loading into matlab.

Data needs to be prepped for loading into matlab. Outline Preparing data sets CTD Data from Tomales Bay Clean up Binning Combined Temperature Depth plots T S scatter plots Multiple plots on a single figure What haven't you learned in this class? Preparing

More information

Dr. Iyad Jafar. Adapted from the publisher slides

Dr. 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 information

MATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting

MATLAB 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 information

NENS 230 Assignment 4: Data Visualization

NENS 230 Assignment 4: Data Visualization NENS 230 Assignment 4: Data Visualization Due date: Tuesday, October 20, 2015 Goals Get comfortable manipulating figures Familiarize yourself with common 2D and 3D plots Understand how color and colormaps

More information

MMAE 540 Homework 9. Stefan Stevanovic. Nov. 20, 2014

MMAE 540 Homework 9. Stefan Stevanovic. Nov. 20, 2014 MMAE Homework Stefan Stevanovic Nov., Problem : Generate a PRM (Probabilistic Road Map) path planner that maps the path from the goal location (X, Y ) = (, ) to a final location (X, Y ) = (, ), with the

More information

Fundamentals of MATLAB Usage

Fundamentals of MATLAB Usage 수치해석기초 Fundamentals of MATLAB Usage 2008. 9 담당교수 : 주한규 joohan@snu.ac.kr, x9241, Rm 32-205 205 원자핵공학과 1 MATLAB Features MATLAB: Matrix Laboratory Process everything based on Matrix (array of numbers) Math

More information

EXERCISES Introduction to MATLAB: Graphics

EXERCISES Introduction to MATLAB: Graphics I. Class Materials 1. Download Graphics.tar EXERCISES Introduction to MATLAB: Graphics From a web browser: Open your browser and go to http://web.mit.edu/acmath/matlab/intromatlab. Download the file Graphics.tar

More information

Introduction to PartSim and Matlab

Introduction 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 information

PROGRAMMING WITH MATLAB WEEK 6

PROGRAMMING 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 information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Zhiyu Zhao (sylvia@cs.uno.edu) The LONI Institute & Department of Computer Science College of Sciences University of New Orleans 03/02/2009 Outline What is MATLAB Getting Started

More information

k-nn classification & Statistical Pattern Recognition

k-nn classification & Statistical Pattern Recognition k-nn classification & Statistical Pattern Recognition Andreas C. Kapourani (Credit: Hiroshi Shimodaira) February 27 k-nn classification In classification, the data consist of a training set and a test

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Stefan Güttel September 22, 2017 Contents 1 Introduction 2 2 Matrices and Arrays 2 3 Expressions 3 4 Basic Linear Algebra commands 4 5 Graphics 5 6 Programming Scripts 6 7 Functions

More information

More on Plots. Dmitry Adamskiy 30 Nov 2011

More 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 information

1 >> Lecture 4 2 >> 3 >> -- Graphics 4 >> Zheng-Liang Lu 184 / 243

1 >> 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 information

Warm-Up Exercises. Find the x-intercept and y-intercept 1. 3x 5y = 15 ANSWER 5; y = 2x + 7 ANSWER ; 7

Warm-Up Exercises. Find the x-intercept and y-intercept 1. 3x 5y = 15 ANSWER 5; y = 2x + 7 ANSWER ; 7 Warm-Up Exercises Find the x-intercept and y-intercept 1. 3x 5y = 15 ANSWER 5; 3 2. y = 2x + 7 7 2 ANSWER ; 7 Chapter 1.1 Graph Quadratic Functions in Standard Form A quadratic function is a function that

More information

Spreadsheet and Graphing Exercise Biology 210 Introduction to Research

Spreadsheet and Graphing Exercise Biology 210 Introduction to Research 1 Spreadsheet and Graphing Exercise Biology 210 Introduction to Research There are many good spreadsheet programs for analyzing data. In this class we will use MS Excel. Below are a series of examples

More information

W1005 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. 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 information

PyPlot. The plotting library must be imported, and we will assume in these examples an import statement similar to those for numpy and math as

PyPlot. 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 information

SGN Introduction to Matlab

SGN 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 information

PERI INSTITUTE OF TECHNOLOGY DEPARTMENT OF ECE TWO DAYS NATIONAL LEVEL WORKSHOP ON COMMUNICATIONS & IMAGE PROCESSING "CIPM 2017" Matlab Fun - 2

PERI INSTITUTE OF TECHNOLOGY DEPARTMENT OF ECE TWO DAYS NATIONAL LEVEL WORKSHOP ON COMMUNICATIONS & IMAGE PROCESSING CIPM 2017 Matlab Fun - 2 Table of Contents PERI INSTITUTE OF TECHNOLOGY DEPARTMENT OF ECE TWO DAYS NATIONAL LEVEL WORKSHOP ON COMMUNICATIONS & IMAGE PROCESSING "CIPM 2017" - 2 What? Matlab can be fun... 1 Plot the Sine Function...

More information

Introudction to Computation and Cognition 2015 Dr. Oren Shriki Shay Ben-Sasson, Ofer Groweiss. MATLAB tutorial

Introudction to Computation and Cognition 2015 Dr. Oren Shriki Shay Ben-Sasson, Ofer Groweiss. MATLAB tutorial Introudction to Computation and Cognition 2015 Dr. Oren Shriki Shay Ben-Sasson, Ofer Groweiss MATLAB tutorial 1 MATLAB is a general-purpose mathematical software that is user friendly and very useful for

More information