peaks: Test problem with multiple peaks

Description Usage Arguments Value Author(s) Examples

View source: R/peaks.R

Description

Generates a benchmark function with multiple peaks.

Usage

1
peaks(x)

Arguments

x

A matrix containing the values of the input variables.

Value

Vector of the same length as x giving the values of the benchmark function.

Author(s)

Laura Villanova, Kate Smith-Miles and Rob J Hyndman

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
x1 <- seq(-3, 3, length = 50)
x2 <- x1

x<-expand.grid(x1, x2)

z <- matrix(peaks(x), nrow = length(x1))

nrz <- nrow(z)
ncz <- ncol(z)
jet.colors <- colorRampPalette( c("red", "yellow") ) 
nbcol <- 100
color <- jet.colors(nbcol)
zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]
facetcol <- cut(zfacet, nbcol)

persp(x1, x2, z, col = color[facetcol], theta = 0, phi = 10, 
	expand = 1, xlab = "x1", ylab = "x2", zlab = "f(x1, x2)", 
	ticktype = "detailed")

emma documentation built on May 2, 2019, 2:47 p.m.