Exam 2 Study Guide - Syntax Zeroes(m,n) Ones(m,n) Plot(x,y)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Syntax Zeroes(m,n) Ones(m,n) Plot(x,y) title(‘My Graph’) Xlabel(‘IV’) Ylabel(‘DV’) Grid on/off Figure(2) hold on/off Plot(x,y ‘: o k’) Indics: solid- dotted: dash dot -. dashed – Points: . o x + * s quare d iamond v ^ < > p enta h epta Bar(x) Barh Bar3h pie pie3 hist Ex: load weight.dat Subplot(1,2,1) Plotweight Title(‘Weight of Freshman Class Men’) Xlabel y label grid on Subplot(1,2,2) hist(weight) X label y lable Meshgrid when you want to combine two matrices with x / + - element by element [g,t]=meshgrid(G,T) Nargin(‘size’) how many inputs Nargout- outputs; if -1 then it varies Uiimport( ‘filename.extension’) <=; >=; ==; R= rand (12,100) For something= R *Returns the first column* (strips the first dimension) For another thing = something’ *Returns a single value* A= [1:3] B= [1:4] C= meshgrid (A,B) C= 4x3 (everything has an element to be added) City= input(‘enter name of a city’) Switch city Case ‘Boston’ disp… Case’Denver’ disp… Otherwise disp not on file Selection = menu(‘Do you want fries with that? ‘, ‘Yes’, ‘No’) Switch selection Case 2 Disp(‘Dude, you’’re getting fries!’) Case 2 Disp(‘Good Choice.’) Interpolation yi = interp1( x, Y, xi) interpolates to find it yi = interp1( Y, xi) yi = interp1( x, Y, xi, method) yi = interp1( x, Y, xi, method, 'extrap') yi = interp1( x, Y, xi, method, extrapval) pp = interp1( x, Y, method, 'pp') X Must be a vector If y is a scalar - Then must have same length of x If x is a scalar- y is to have the same lngth as x. Xi can be sclr Vctr Multidimensional array Yi is the same size as xi: If xi is a scalar or vector, size(yi) equals [length(xi), d1, d2, . .., dk]. If xi is an array of size [m1,m2], yi has size [m1,m2,. ..,mj,d1,d2,. ..,dk o yi = interp1(Y,xi) assumes that x = 1:N, o N is the length of Y for vector Y, Yi=interp1(y,xi) X=1:N Where N is the length of y for vector Yi=inter1( x,y, xi, method) Nearest Linear- straight line (slope) Spline- cubic’s it Pchip- smooth and repsects monotonicity Cubic- same ^ V5cubic- used in matlab does not extrapolate if x is not equally space spline is used It finds values at intermediate points along a one-dimensional function that underlies the data. Interpolation is the same operation as table lookup . Described in table lookup terms, the table is [x,Y] and interp1 looks up the elements of xi in x, and, based upon their locations, returns values yi interpolated within the elements of Y. Table -p =
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/14/2008 for the course CISC 106 taught by Professor Mcgeary during the Spring '08 term at University of Delaware.

Page1 / 3

Exam 2 Study Guide - Syntax Zeroes(m,n) Ones(m,n) Plot(x,y)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online