MathGroup Archive 2012

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

Search the Archive

Re: Axes scales on ListPlot family

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125908] Re: Axes scales on ListPlot family
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Fri, 6 Apr 2012 06:00:10 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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:

ListPlot[f[i],{i,0,1,0.1}]

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?

Thanks
JK

Hi,
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];
plotFunction[f]

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
IEE S.A.
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 iee.lu






  • 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