Description Usage Arguments Details Value Note See Also Examples

An example functions in two variables, with peaks.

1 | ```
peaks(v = 49, w)
``` |

`v` |
vector, whose length will be used, or a natural number. |

`w` |
another vector, will be used in |

`peaks`

is a function of two variables, obtained by translating
and scaling Gaussian distributions, which is useful for demonstrating
three-dimensional plots.

Returns three matrices as a list with `X`

, `Y`

, and `Z`

components, the first two being the result of the `meshgrid`

function,
and `Z`

the application of the following function at the points of
`X`

and `Y`

:

```
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)
```

The variant that `peaks()`

will display the 3-dim. graph as in Matlab
is not yet implemented.

1 2 3 4 5 6 7 |

```
$X
[,1] [,2] [,3]
[1,] -3 0 3
[2,] -3 0 3
[3,] -3 0 3
$Y
[,1] [,2] [,3]
[1,] -3 -3 -3
[2,] 0 0 0
[3,] 3 3 3
$Z
[,1] [,2] [,3]
[1,] 6.671280e-05 -0.2449540 -5.864188e-06
[2,] -3.650620e-02 0.9810118 3.312495e-02
[3,] 3.223536e-05 0.2998710 4.102973e-05
```

pracma documentation built on Jan. 30, 2018, 3:01 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.