previous: create arrays
next: define vectors

04: Create and plot an array

Create an array x=(2, 2.3, 2.6, ..., 4.7, 5)
and then plot   sqrt(x) vs. x --
as a line plot, and then as a point plot

Mathematica:

x = Table[ w, {w, 2.0, 5.0, 0.3} ]

ListPlot[Transpose[{x,Sqrt[x]}], PlotJoined->True]

ListPlot[Transpose[{x,Sqrt[x]}]]

Matlab:

x = 2 : 0.3 : 5

plot(x, sqrt(x))

plot(x, sqrt(x), '*')      (or interactively)

Maple:

t := [seq(2+i*0.3,i=0..10)];

listplot(map(sqrt,t));

listplot(map(sqrt,t),style=point);

IDL:

x = 0.3 * findgen(11) + 2

plot, x, sqrt(x)

plot, x, sqrt(x), psym=4