Statistics and Simple Plots. Outline Announcements: –Homework II: due Wed. by 5, by e-mail Cookie Challenge Statistics Simple plots Tutorial 4.

Slides:



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

MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Plotting Selim Aksoy Bilkent University Department of Computer Engineering
2D Plots 1 ENGR 1181 MATLAB 12.
Introduction to Graphing Using MATLAB. Line Graphs  Useful for graphing functions  Useful for displaying data trends over time  Useful for showing.
Matlab Graphics S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: 2D Graphics.
Chapter 15 Above: GPS time series from southern California after removing several curve fits to the data.
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.
MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 4.
MATLAB GRAPHICS 2-D.
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
Graphics in MATLAB Week 15 – 5/5/09 Kate Musgrave
Stochastic Simulations Six degrees of Kevin Bacon.
EGR106 Week 6 MATLAB FILES Two Dimensional Plots Multiple Plots
Exam #3 Review: Comprehensive Exam Class 14.2 Palm Matlab Book Ch. 1-5.
Vectors and Plotting Selim Aksoy Bilkent University Department of Computer Engineering
MATLAB Week 3 17 November Outline Graphics – Basic plotting – Editing plots from GUI – Editing plots from m-file – Advanced plotting commands.
EGR106 Week 4 Two Dimensional Plots Multiple Plots Plot Formatting Homework.
Introduction to Matlab 332:202 Discrete Mathematics Spring 2007.
Introduction to Matlab Jianguo Wang CSSCR September 2009.
An introduction to Plotting in MATLAB Rikard Johansson Department of Biomedical Engineering (IMT) Linköping University
Matlab intro The Environment
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.
MATLAB Plotting With MATLAB 1. Two Dimensional Plots The xy plot is the most commonly used plot by engineers The independent variable is usually called.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
Text Processing. Outline Announcements: –Homework I: due Today. by 5, by Discuss on Friday. –Homework II: on web HW I: question 7 Finish functions.
MATLAB Week 4 01 December Outline More plotting – A few other 3-D plotting functions – Basic volume visualization Creating functions Vectorized.
MATLAB Tutorial EE 327 Signals and Systems 1. What is MATLAB? MATLAB – Matrix Laboratory The premier number-crunching software Extremely useful for signal.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Lecture 10 2D plotting & curve fitting Subplots Other 2-D Plots Other 2-D Plots Curve fitting © 2007 Daniel Valentine. All rights reserved. Published by.
Recap Sum and Product Functions Matrix Size Function Variance and Standard Deviation Random Numbers Complex Numbers.
Statistics and Simple Plots. Outline Announcements: –Homework II: due Today. by 5, by Statistics Simple plots.
Outline Announcements –HW II due Friday –HW III option Interpolation Colormaps.
Outline Announcements –Homework I due Wed. 5PM by Subject: CIS 402 Homework 1 Plain text Not allowed to use errorbar Try to do plotCI without looking.
Introduction to MATLAB Session 5 Simopekka Vänskä, THL 2010.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
Figures & Axes, Printing & Saving. Outline Announcements –Homework I due Wed. 5PM by –No lecture on Fri. 10/26, rescheduled to Wed. 10/31 at 8AM.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
Introduction to MATLAB Session 2 Simopekka Vänskä, THL Department of Mathematics and Statistics University of Helsinki 2010.
MATLAB Jirawat Kanjanapitak (Tae). What is MATLAB A computer program for doing numerical computation including; Arithmetic, Polynomials, Graphics, 2-D.
GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Deniz Savas & Mike Griffiths May 2015.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.1 Simple Plot of Time.
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.
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.
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
Computer Application in Engineering Design
Signals in Matlab Matlab as a name stands for Matrix Laboratory.
3D-Graphs A 3D surface is defined as: z = f(x, y)
Lecture 25.
Lecture 25: Exploring data
2D Routines in 3D.
Matrices and Arrays.
Lecture 10 2D plotting & curve fitting
MATLAB How to use (using M-files) Double click this icon
Data Presentation Carey Williamson Department of Computer Science
MATLAB Tutorial Dr. David W. Graham.
MATLAB How to use (using M-files) Double click this icon
Tutorial 2 SEG7550 Introduction to MATLAB II
MATLAB How to use (using M-files)
Advanced Plotting Techniques
CSCI N317 Computation for Scientific Applications Unit 1 – 5 MATLAB
Plotting Signals in MATLAB
Carey Williamson Department of Computer Science University of Calgary
How to Use MATLAB A Brief Introduction.
Introduction to Matlab
Presentation transcript:

Statistics and Simple Plots

Outline Announcements: –Homework II: due Wed. by 5, by Cookie Challenge Statistics Simple plots Tutorial 4

Homework II myfft.m –Inputs: x, t (a signal) –Outputs: a, b, (Fourier coefficients) f (Frequencies) FourierMat.m –Inputs: a, b, f (Fourier coefficients & frequencies) t (a vector of times) –Outputs: x (signal at times in t)

Homework Policy You may discuss problems sets with others in the class BUT--write-up should be done alone

Cookie Challenge

Statistics Descriptive –summarize properties of data Comparative –compare data sets –test hypotheses

Descriptive Stats Most common descriptive stats are in “datafun” toolbox –mean, median, min/max, std –vectorized, operate on columns –Ex: x & y are column vectors with data m=mean([x,y]) m(1)=mean of x, m(2)=mean of y Can force mean to work on rows: m=mean([x,y],2);%mean along 2nd dimension

Descriptive Stats The descriptive stats functions don’t like nans –mean([nan;x]) returns NaN The statistics toolbox has nanmean, nanmin, nanstd,etc. that ignore nans –Simple to write your own versions

Basic Comparative Stats Curve fitting with polyfit –coefs=polyfit(x,y,n):%fits n-th order polynomial to data [x.^n, x.^n-1,…,x,1]*coefs ~ y –Correlation coefficient (r) with corrcoef r=corrcoef([x,y]); r=[ r(x,x), r(x,y); r(y,x), r(y,y)] will also return probability

“Advanced” Comparative Stats Statistics toolbox has functions for –statistical distributions –parameter estimation –statistical tests A useful function: –regress--like polyfit, but get stats (p, R2) Fits any linear model (anything you can write as a matrix-vector product b=regress(y,X) finds b s.t. –X*b ~ y

Fitting Polynomials with \ x,y are (column) vectors of observations –X=[x.^3 x.^2 x.^1 x.^0]; %matrix –If we know b: y=X*b; –Instead, we know y: b=X\y –Matrix division--Matlab computes the inverse of the matrix –\ is very smart--can deal with a variety of matrices in a very intelligent manner.

Summary of Matlab Stats Matlab has basic stats built-in Can expand with the stats toolbox Most statistical tests are easy to program –Can program Matlab to deal with your data! –look for vector-products!

Simple plots Plot 1D functions (2D data) with plot –plot(x,y) plots (x,y) with a blue line –plot(y) is plot([1:length(y)],y) –plot(x,[y1,y2,y3]) plots (x,yX) each in a different color

Customizing plot plot(x,y,’r’) is a red line plot(x,y,’o’) plots circles rather than lines plot(x,y,’yp’) plots yellow pentagrams Type help plot to get more options

Specialized 1D graphics bar--bar chart pie--pie chart polar--polar coordintes semilogy, semilogx, loglog--plotting with log-scales

2D basics Assume data Z is on a regular grid defined by X and Y pcolor, imagesc, contour plot in 2D surf, mesh plot in 3D (perspective)

2D graphics use colors to represent data Color of z is defined by a colormap and caxis several built-in colormaps--help graph3d Used in Lecture 01 2D basics

Generic graphics functions xlabel, ylabel, title label your plots hold on--allows multiple plots on same axes clf clears the figure window axis([xmin,xmax,ymin,ymax]) controls axis limits

Multiple plots subplot(m,n,j) creates the jth plot in an m-by-n matrix of plots (row-1)*n+col n=col m=row

Axes & Figures Matlab plots into figures –figure(n) makes n the current figure or creates a figure numbered n Figures contain axes –If no axes exist in current figure, then any graphics call will create one –Can explicitly create with subplot or axes

Printing figures print will send gcf to printer (or use GUI) print -depsc fname.eps will save graphics in EPS format print -djpeg fname.jpg will save into JPG format

Summary of Matlab Graphics Matlab has most standard plots built in Also has advanced tools for visualization of high dimensional data –colors, light, isosurfaces, slices The best thing about Matlab graphics are that they can be programmed –put graphics statements in functions for display or debugging Take CIS 402!

Tutorial 4: Temp. on NW Atlantic Shelf Data consist of yearly mean temperatures between m depth from 4 locations on NW Atlantic Shelf: Are the temp’s independent? Practice working with data, simple stats and graphics Emerald Basin Georges Basin Jordan Basin Wilkinson Basin