-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpeaks.html
254 lines (224 loc) · 21.6 KB
/
peaks.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" itemscope itemtype="http://www.mathworks.com/help/schema/MathWorksDocPage">
<head>
<meta xmlns="http://www.w3.org/1999/xhtml" charset="utf-8"></meta>
<meta xmlns="http://www.w3.org/1999/xhtml" name="viewport" content="width=device-width, initial-scale=1.0"></meta>
<meta xmlns="http://www.w3.org/1999/xhtml" http-equiv="X-UA-Compatible" content="IE=edge"></meta>
<title>peaks</title>
<script xmlns="http://www.w3.org/1999/xhtml" type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "../index.html",
"name": "MATLAB"
}
}
,
{
"@type": "ListItem",
"position": 2,
"item": {
"@id": "../graphics.html",
"name": "Graphics"
}
}
,
{
"@type": "ListItem",
"position": 3,
"item": {
"@id": "../2-and-3d-plots.html",
"name": "2-D and 3-D Plots"
}
}
,
{
"@type": "ListItem",
"position": 4,
"item": {
"@id": "../surfaces-polygons-and-volumes.html",
"name": "Surfaces, Volumes, and Polygons"
}
}
,
{
"@type": "ListItem",
"position": 5,
"item": {
"@id": "../surface-and-mesh-plots-1.html",
"name": "Surface and Mesh Plots"
}
}]
}</script><script xmlns="http://www.w3.org/1999/xhtml" type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ItemList",
"name": "VisibleBreadcrumbs",
"itemListElement":
[
"surface-and-mesh-plots-1"
],
"itemListOrder": "http://schema.org/ItemListOrderAscending"
}
</script>
<meta xmlns="http://www.w3.org/1999/xhtml" name="chunktype" content="refpage"></meta><meta xmlns="http://www.w3.org/1999/xhtml" name="refentity" itemprop="refentity" content="function:peaks"></meta><link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/bootstrap.min.css" rel="stylesheet" type="text/css"></link>
<meta xmlns="http://www.w3.org/1999/xhtml" http-equiv="Content-Script-Type" content="text/javascript"></meta>
<meta xmlns="http://www.w3.org/1999/xhtml" name="toctype" itemprop="pagetype" content="fcn"></meta>
<meta xmlns="http://www.w3.org/1999/xhtml" name="infotype" itemprop="infotype" content="ref/function"></meta>
<meta xmlns="http://www.w3.org/1999/xhtml" name="description" itemprop="description" content="This MATLAB function returns a 49-by-49 matrix."></meta><script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript" src="../../includes/product/scripts/jquery/jquery-latest.js"></script>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/site6.css" rel="stylesheet" type="text/css"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/site6_lg.css" rel="stylesheet" media="screen and (min-width: 1200px)"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/site6_md.css" rel="stylesheet" media="screen and (min-width: 992px) and (max-width: 1199px)"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/site6_sm+xs.css" rel="stylesheet" media="screen and (max-width: 991px)"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/site6_sm.css" rel="stylesheet" media="screen and (min-width: 768px) and (max-width: 991px)"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/site6_xs.css" rel="stylesheet" media="screen and (max-width: 767px)"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/site6_offcanvas.css" rel="stylesheet" type="text/css"></link>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/shared/scripts/l10n.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/shared/scripts/docscripts.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/shared/scripts/f1help.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/docscripts.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/shared/scripts/mw.imageanimation.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/shared/scripts/jquery.highlight.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/underscore-min.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/examples.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/use_platform_screenshots.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/suggest.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/shared/scripts/overload.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/shared/scripts/helpservices.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/jquery/jquery.mobile.custom.min.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/bootstrap.min.js" type="text/javascript"></script>
<script xmlns="http://www.w3.org/1999/xhtml" src="../../includes/product/scripts/global.js"></script>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/doc_center_base.css" rel="stylesheet" type="text/css"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/doc_center_installed.css" rel="stylesheet" type="text/css"></link>
<link xmlns="http://www.w3.org/1999/xhtml" href="../../includes/product/css/doc_center_print.css" rel="stylesheet" type="text/css" media="print"></link>
<script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript" src="../../includes/shared/equationrenderer/release/MathRenderer.js"></script>
</head>
<body id="responsive_offcanvas">
<div xmlns="http://www.w3.org/1999/xhtml" id="doc_header_spacer" class="header"></div>
<div xmlns="http://www.w3.org/1999/xhtml" class="sticky_header_container includes_subnav affix-top"><div class="section_header level_3"><div class="container-fluid"><div class="row" id="mobile_search_row"><div class="col-xs-12 has_horizontal_local_nav" id="section_header_title"><div class="section_header_content"><div class="section_header_title"><h1><a href="../../documentation-center.html">Documentation</a></h1></div><button type="button" class="navbar-toggle collapsed subnav visible-xs" data-toggle="collapse" data-target=".mobile_subnav_content"><span class="icon-arrow-down icon_24"></span></button></div><div class="crux_nav_container hidden-xs"><div class="crux_nav"><ul id="topnav_main"><li id="crux_nav_documentation" class="crux_nav_active"><a>All</a></li><li id="crux_nav_example"><a href="../examples.html?category=surface-and-mesh-plots-1">Examples</a></li><li id="crux_nav_function"><a href="../referencelist.html?type=function&category=surface-and-mesh-plots-1">Functions</a></li><li role="presentation" class="dropdown" id="topnav_more" style="display:none;"><a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> More <span class="caret"></span></a><ul class="dropdown-menu"></ul></li></ul></div></div></div><div class="col-xs-12" id="mobile_search"><div class="search_nested_content_container"><form id="docsearch_form" name="docsearch_form" method="get" data-release="R2019a" data-language="en" action="../../templates/searchresults.html"><div class="input-group tokenized_search_field"><label class="sr-only">Search Help</label><input type="text" class="form-control conjoined_search" autocomplete="off" name="qdoc" placeholder="Search Help" id="docsearch"> </input><div class="input-group-btn"><button type="submit" name="submitsearch" id="submitsearch" class="btn icon-search btn_search_adjacent btn_search icon_16" tabindex="-1"></button></div></div></form></div><button class="btn icon-remove btn_search pull-right icon_32 visible-xs" data-toggle="collapse" href="#mobile_search" aria-expanded="false" aria-controls="mobile_search"></button></div><div class="visible-xs" id="search_actuator"><button class="btn icon-search btn_search pull-right icon_16" data-toggle="collapse" href="#mobile_search" aria-expanded="false" aria-controls="mobile_search"></button></div></div><div class="row visible-xs" id="mobile_subnav"><div class="col-xs-12"><div class="navbar-collapse collapse mobile_subnav_content"><div class="crux_nav_container"><div class="crux_nav"><ul class="nav navbar-nav subnav"><li id="crux_nav_mobile_documentation" class="crux_nav_active"><a>All</a></li><li id="crux_nav_mobile_example"><a href="../examples.html?category=surface-and-mesh-plots-1">Examples</a></li><li id="crux_nav_mobile_function"><a href="../referencelist.html?type=function&category=surface-and-mesh-plots-1">Functions</a></li></ul></div></div></div></div></div></div></div><div class="horizontal_nav"><div class="horizontal_nav_container"><div class="offcanvas_actuator" data-toggle="offcanvas" data-target="#sidebar" id="nav_toggle"><button type="button" class="btn"><span class="sr-only">Toggle navigation</span><span class="icon-menu"></span></button><a href="javascript:void(0)" class="offcanvas_actuator_label" id="translation_icon-filter" tabindex="0"></a><a href="javascript:void(0)" class="offcanvas_actuator_close" tabindex="0"></a></div><div class="offcanvas_horizontal_nav"><div class="container-fluid"><div class="row"><div class="col-md-12 hidden-xs hidden-sm"></div></div></div></div></div></div></div><div class="row-offcanvas row-offcanvas-left">
<div xmlns="http://www.w3.org/1999/xhtml" class="sidebar-offcanvas" id="sidebar" role="navigation">
<nav class="offcanvas_nav" role="navigation">
<ul class="nav_breadcrumb"><li itemscope="" itemtype="http://www.data-vocabulary.org/Breadcrumb" itemprop="breadcrumb"><a href="../../documentation-center.html" itemprop="url"><span itemprop="title">Documentation Home</span></a></li></ul>
<ul class="nav_disambiguation"><li><a href="../index.html">MATLAB</a>
</li>
<li itemscope="" itemtype="http://www.data-vocabulary.org/Breadcrumb" itemprop="breadcrumb"><a href="../graphics.html" itemprop="url"><span itemprop="title">Graphics</span></a></li><li itemscope="" itemtype="http://www.data-vocabulary.org/Breadcrumb" itemprop="breadcrumb"><a href="../2-and-3d-plots.html" itemprop="url"><span itemprop="title">2-D and 3-D Plots</span></a></li><li itemscope="" itemtype="http://www.data-vocabulary.org/Breadcrumb" itemprop="breadcrumb"><a href="../surfaces-polygons-and-volumes.html" itemprop="url"><span itemprop="title">Surfaces, Volumes, and Polygons</span></a></li><li itemscope="" itemtype="http://www.data-vocabulary.org/Breadcrumb" itemprop="breadcrumb"><a href="../surface-and-mesh-plots-1.html" itemprop="url"><span itemprop="title">Surface and Mesh Plots</span></a></li></ul><ul class="nav_scrollspy nav">
<li class="nav_scrollspy_function notranslate"><a href="#responsive_offcanvas"><span class="refname">peaks</span></a></li>
<li class="nav_scrollspy_title" id="SSPY810-refentry">On this page</li>
<!--ADD_REFENTRY_TITLE_HERE 11--><li><a href="#f30-537823" class="intrnllnk">Syntax</a></li><li><a href="#f30-537837" class="intrnllnk">Description</a></li><li><a href="#bsy3zz2-1" class="intrnllnk">Examples</a><ul class="nav"><li><a href="#bufr3ca" class="intrnllnk">Peaks Surface</a></li></ul></li><li><a href="#f30-537820_seealso" class="intrnllnk">See Also</a></li></ul>
</nav>
<script src="../../includes/product/scripts/offcanvas.js"></script></div><!--END.CLASS sidebar-offcanvas-->
<div class="content_container" id="content_container" itemprop="content">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<section xmlns="http://www.w3.org/1999/xhtml" id="doc_center_content" lang="en"><div id="pgtype-ref-function"><div class="function_ref"><span id="f30-537820" class="anchor_target"></span><h1 class="r2019a notranslate" itemprop="title"><span class="refname">peaks</span></h1><div class="doc_topic_desc"><div class="purpose_container"><p itemprop="purpose">Example function of two variables</p><div class="switch"><a href="javascript:void(0);" id="expandAllPage" data-allexpanded="true1">collapse all in page</a></div></div></div>
<span id="f30-537823" class="anchor_target"></span><div class="ref_sect"><h2 id="f30-537823">Syntax</h2><div class="syntax_signature"><p class="synopsis"><code>Z = peaks;<br/>
Z = peaks(n);<br/>
Z = peaks(V);<br/>
Z = peaks(X,Y);<br/>
peaks(...)<br/>
[X,Y,Z] = peaks(...);<br/>
</code></p></div></div><div class="clear"></div><div id="f30-537837_div" class="ref_sect"><h2 id="f30-537837">Description</h2><p><code class="literal">peaks</code> is a function of two variables, obtained
by translating and scaling Gaussian distributions, which is useful
for demonstrating <a href="mesh.html"><code class="function">mesh</code></a>, <a href="surf.html"><code class="function">surf</code></a>, <a href="pcolor.html"><code class="function">pcolor</code></a>, <a href="contour.html"><code class="function">contour</code></a>, and so on.</p><p><span itemprop="syntax"><code id="f30-537839" class="synopsis">Z = peaks;</code></span> returns a 49-by-49
matrix.</p><p><span itemprop="syntax"><code id="f30-537841" class="synopsis">Z = peaks(n);</code></span> returns
an <code class="literal">n</code>-by-<code class="literal">n</code> matrix.</p><p><span itemprop="syntax"><code id="f30-537843" class="synopsis">Z = peaks(V);</code></span> returns
an <code class="literal">n</code>-by-<code class="literal">n</code> matrix, where <code class="literal">n
= length(V)</code>.</p><p><span itemprop="syntax"><code id="f30-537845" class="synopsis">Z = peaks(X,Y);</code></span> evaluates <code class="literal">peaks</code> at
the given <code class="literal">X</code> and <code class="literal">Y</code> (which must
be the same size) and returns a matrix the same size.</p><p><span itemprop="syntax"><code id="f30-537847" class="synopsis">peaks(...)</code></span> (with no output
argument) plots the peaks function with <code class="function">surf</code>.
Use any of the input argument combinations in the previous syntaxes.</p><p><span itemprop="syntax"><code id="f30-537849" class="synopsis">[X,Y,Z] = peaks(...);</code></span>
returns two additional matrices, <code class="literal">X</code> and <code class="literal">Y</code>,
for parametric plots, for example, <code class="literal">surf(X,Y,Z,del2(Z))</code>.
If not given as input, the underlying matrices <code class="literal">X</code> and <code class="literal">Y</code> are</p><div class="code_responsive"><pre class="programlisting">[X,Y] = meshgrid(V,V)
</pre></div><p>where <code class="literal">V</code> is a given vector, or <code class="literal">V</code> is
a vector of length <code class="literal">n</code> with elements equally spaced
from -3 to 3. If no input argument is given, the default <code class="literal">n</code> is
49.</p></div><div class="examples"><h2 id="bsy3zz2-1">Examples</h2><div class="expandableContent" id="expandableExamples"><p class="switch"><a href="javascript:void(0);" class="expandAllLink" data-allexpanded="true3">collapse all</a></p><div class="panel-group" role="tablist" aria-multiselectable="true" id="expand_panel_heading_bufr3ca"><div class="panel panel-default "><div role="tab" data-toggle="collapse" id="expand_panel_heading_bufr3ca" data-target="#expand_panel_body_bufr3ca" aria-controls="expand_panel_body_bufr3ca" class="panel-heading add_cursor_pointer" aria-expanded="true"><h3 class="panel-title" id="bufr3ca">Peaks Surface<br/> </h3><span class="icon-arrow-open-down icon_24"></span><span class="icon-arrow-open-right icon_24"></span></div><div role="tabpanel" id="expand_panel_body_bufr3ca" aria-labelledby="expand_panel_heading_bufr3ca" class="panel-collapse collapse in"><div class="panel-body"><div class="pull-right examples_short_list" style="width:250px; margin-left: 10px; margin-bottom: 10px;"><div data-pane="metadata" style="margin-bottom: 0px;" class="panel metadata_container"><div class="panel-body metadata_content" style="padding-top:0px; padding-bottom:0px;"><div class="row"><div class="col-xs-12"><a class="btn btn_secondary btn-block" href="matlab:openExample('graphics2/PeaksSurfaceExample')">Open Live Script</a></div></div></div></div></div><script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "DigitalDocument",
"headline": "Peaks Surface",
"description": "Create a 5-by-5 matrix of peaks and display the surface.",
"thumbnailURL": "../../examples/graphics2/win64/PeaksSurfaceExample_01.png",
"genre": "Live Script",
"isBasedOn": {
"@type": "Product",
"name": "MATLAB"
},
"isPartOf": {
"@type": "CreativeWork",
"url": "peaks.html"
},
"identifier": "graphics2.PeaksSurfaceExample",
"name": "PeaksSurfaceExample",
"url": "peaks.html#bufr3ca"
}</script><script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "PropertyValue",
"name": "open_command",
"value": "matlab:openExample('graphics2/PeaksSurfaceExample')"
}</script><script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ItemList",
"name": "ExampleSourceFiles",
"itemListElement":
[
"PeaksSurfaceExample.mlx"
],
"itemListOrder": "http://schema.org/ItemListOrderAscending"
}
</script><p class="shortdesc">Create a 5-by-5 matrix of peaks and display the surface.</p><div class="code_responsive"><div class="programlisting"><div class="codeinput"><pre>figure
peaks(5);</pre></div></div></div><div class="code_responsive"><div class="programlisting"><div class="codeoutput"><pre>
z = 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)
</pre></div></div></div><div class="informalfigure"><div id="d117e987281" class="mediaobject"><p><img src="../../examples/graphics2/win64/PeaksSurfaceExample_01.png" alt="" width="560"></img></p></div></div><div class="procedure"></div></div></div></div></div><div itemscope="" itemtype="http://www.mathworks.com/help/schema/MathWorksDocPage/Example" itemprop="example" class="em_example"><meta itemprop="exampleid" content="graphics2-PeaksSurfaceExample"></meta><meta itemprop="exampletitle" content="Peaks Surface"></meta></div></div></div><div class="ref_sect"><h2 id="f30-537820_seealso">See Also</h2><p><span itemscope="" itemtype="http://www.mathworks.com/help/schema/MathWorksDocPage/SeeAlso" itemprop="seealso"><a itemprop="url" href="meshgrid.html"><span itemprop="name"><code class="function">meshgrid</code></span></a></span> | <span itemscope="" itemtype="http://www.mathworks.com/help/schema/MathWorksDocPage/SeeAlso" itemprop="seealso"><a itemprop="url" href="surf.html"><span itemprop="name"><code class="function">surf</code></span></a></span></p></div><div class="release_introduced"><h4>Introduced before R2006a</h4></div>
</div></div><div class="clearfix"></div>
<div align="center" class="feedbackblock"><iframe id="doc_survey"></iframe></div><script src="../../includes/shared/scripts/docsurvey.js"></script>
</section>
</div>
</div>
</div><!--close_0960-->
</div><!--close_0970-->
<div xmlns="http://www.w3.org/1999/xhtml" class="body_trail_container">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="row"><div class="col-xs-12 col-sm-3"><h5><a href="../index.html?s_cid=doc_ftr">MATLAB Documentation</a></h5>
<ul class="list-unstyled hidden-xs"><li><a href="../examples.html?s_cid=doc_ftr">Examples</a></li>
<li><a href="../referencelist.html?type=function&s_cid=doc_ftr">Functions</a></li>
<li><a href="../release-notes.html?s_cid=doc_ftr">Release Notes</a></li>
<li><a href="https://www.mathworks.com/help/releases/R2019a/pdf_doc/matlab/index.html?s_cid=doc_ftr">PDF Documentation</a></li>
</ul>
</div>
<div class="col-xs-12 col-sm-3"><h5><a href="https://www.mathworks.com/support.html?s_cid=doc_ftr">Support</a></h5>
<ul class="list-unstyled hidden-xs"><li><a href="https://www.mathworks.com/matlabcentral/answers/index?s_cid=doc_ftr">MATLAB Answers</a></li><li><a href="https://www.mathworks.com/support/install-matlab.html?s_cid=doc_ftr">Installation Help</a></li><li><a href="https://www.mathworks.com/support/bugreports/?s_cid=doc_ftr">Bug Reports</a></li><li><a href="https://www.mathworks.com/products/availability.html?s_cid=doc_ftr">Product Requirements</a></li><li><a href="https://www.mathworks.com/downloads/?s_cid=doc_ftr">Software Downloads</a></li></ul>
</div>
</div>
</div>
</div>
</div><!--END.CLASS container-fluid-->
</div><!--END.CLASS body_trail_container-->
<footer xmlns="http://www.w3.org/1999/xhtml" id="footer" class="bs-footer">
<div class="container-fluid">
<div class="footer">
<div class="row">
<div class="col-xs-12">
<p class="copyright">© 1994-2019 The MathWorks, Inc.</p>
<ul class="footernav"><li class="footernav_help"><a href="MATLAB:web(matlab.internal.licenseAgreement)">Terms of Use</a></li><li class="footernav_patents"><a href="MATLAB:web([matlabroot '/patents.txt'])">Patents</a></li><li class="footernav_trademarks"><a href="MATLAB:web([matlabroot '/trademarks.txt'])">Trademarks</a></li><li class="footernav_piracy"><a href="MATLAB:web([docroot '/acknowledgments.html'])">Acknowledgments</a></li></ul></div>
</div>
</div>
</div>
</footer>
</div><!--close row-offcanvas-->
</body>
</html>