Learn R Programming

Rgnuplot (version 1.0.3)

GpplotPolyFit: Plots a polynomial fit in one function call

Description

GpplotPolyFit Plots a polynomial fit without the need to define handles

Usage

GpplotPolyFit(x, y, order)

Arguments

x
array with the values of x
y
array with the values of y = f(x)
order
order of the polynomial

Value

See Also

Gpinit

Examples

Run this code
polnorder <- 7# order of the polynomial
npoints <- 20 # number of points to plot
xpoints <- ( 0:npoints ) * 0.1 # x values
wpoints <- c(1,10^ -( 0:polnorder )) # "a" to "h" values
xPower <- outer(xpoints, 0:7, '^')
ypoints <- colSums(wpoints[1:8] * t(xPower))
## Not run: GpplotPolyFit(xpoints, ypoints, 7)

Run the code above in your browser using DataLab