Learn R Programming

popdemo (version 0.1-2)

S3 plot method for transfer functions: Plot transfer function

Description

Plot a transfer function

Usage

## S3 method for class 'tfa':
plot(x, xvar=NULL, yvar=NULL, ...)

Arguments

x
an object of class 'tfa' created using tfa or inertia.tfa.
xvar,yvar
(optional) the variables to plot on the x and y axes. May be "p", "lambda" or "inertia". Defaults to xvar="p" and yvar="lambda" for objects created using tfa and
...
arguments to be passed to methods: see par and plot.

Details

Plots transfer functions (class tfa) created using tfa or inertia.tfa.

See Also

tfa, inertia.tfa

Examples

Run this code
# Create a 3x3 matrix
    A <- matrix(c(0,1,2,0.5,0.1,0,0,0.6,0.6), byrow=TRUE, ncol=3)
    A

    # Calculate the transfer function of A[3,2] given a range of lambda
    evals<-eigen(A)$values
    lmax<-which.max(Re(evals))
    lambda<-Re(evals[lmax])
    lambdarange <- seq(lambda-0.1, lambda+0.1, 0.01)
    transfer<-tfa(A, d=c(0,0,1), e=c(0,1,0), lambdarange=lambdarange)
    transfer

    # Plot the transfer function (defaults to lambda~p)
    plot(transfer)

    # Create an initial stage structure
    initial <- c(1,3,2)
    initial

    # Calculate the transfer function of upper bound on inertia 
    # given a perturbation to A[3,2]
    transfer2<-inertia.tfa(A, d=c(0,0,1), e=c(0,1,0), bound="upper",
                          prange=seq(-0.6,0.4,0.01))
    transfer2

    # Plot the transfer function (defaults to p and inertia in
    # this case)
    plot(transfer2)

    # Plot lambda and inertia
    plot(transfer2, xvar="lambda", yvar="inertia")

Run the code above in your browser using DataLab