previous: fit a polynomial
next: solving ODEs

14: Define a function f(x), and plot it

Define f(x) = 2e-x/8sin(1.2x), and plot it over [0,10]

Mathematica:

f[x_] := 2Exp[-x/8]Sin[1.2x]
Plot[ f[x], {x,0,10} ];

Matlab:

syms x y
y = 2*exp(-x/8)*sin(1.2*x)
ezplot(y, [0,10])

Maple:

xxx

IDL:

You can define a function in IDL, but plotting always involves discrete data points, so one way or another one must calculate an array y of points.

x = 0.1 * fltarr(101)
y = 2.0 * exp(-x/8) * sin(1.2 * x)
plot, x, y