12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ezcontourf( x,y) 31 ( – x) 2 e– x2 – ( y + 1) 210⎛-- x – x3 – y5 5 ⎞ e – x 2 – y 1=–2– --e – ( x + 1) 2 – y 2⎝ ⎠ 3ezcontour requires a string argument that expresses this function using<strong>MATLAB</strong> syntax to represent exponents, natural logs, etc. This function isrepresented by the string:f = ['3*(1−x)^2*exp(−(x^2)−(y+1)^2)',...'− 10*(x/5 − x^3 − y^5)*exp(-x^2−y^2)',...'- 1/3*exp(−(x+1)^2 − y^2)'];For convenience, this string is written on three lines and concatenated into onestring using square brackets.Pass the string variable f to ezcontour along with a domain ranging from −3to 3 and specify a computational grid of 49-by-49:ezcontour(f,[-3,3],49)33 (1−x) 2 exp(−(x 2 ) − (y+1) 2 )− ~~~ x 2 −y 2 )− 1/3 exp(−(x+1) 2 − y 2 )21y0−1−2−3−3 −2 −1 0 1 2 3xIn this particular case, the title is too long to fit at the top of the graph so<strong>MATLAB</strong> abbreviates the string.2-134

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!