MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Axes scales on ListPlot family

Hi all-

I want to basically plot a user defined function discretely.
Let's say f[x] is the function.
What I want to do is:


So I just want to plot the function with 10 arguments from 0 to 10 with incremental of 0.1. However, when we plot it, the x-axis is just the index which is 1 to 10 rather than 0 to 1. Is there anyway to fix this?


Try this:

f[x_] := Sin[4 x];
ListPlot[Table[{i, f[i]}, {i, 0, 1, 0.1}]]

You may now define an expression to plot any custom-defined function (if I got your intention correctly).
Say, like this:

plotFunction[f_] := ListPlot[Table[{i, f[i]}, {i, 0, 1, 0.1}]];

This will work with any custom function, f[x], but you need first to define it.
Try it, for example, with Cos[3x]:

f[x_] := Cos[3 x];

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at

  • Prev by Date: Re: Why does MemberQ[{0,1,2}, expr_] evaluate to True?
  • Next by Date: Error function integral / Wolfram Function reference
  • Previous by thread: Re: Axes scales on ListPlot family
  • Next by thread: fyi, small note on using Mathematica for object based programming