comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Plotting functions in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Plotting functions in IDL [message #5513] Tue, 16 January 1996 00:00 Go to next message
kunstman is currently offline  kunstman
Messages: 2
Registered: December 1995
Junior Member
What is the best way of plotting a function in IDL? As far as I know,
it only handles vectors of discrete data and no equations.

Thanks

Thomas
--
Thomas Kunstmann Hey, you surprised? More than surprised?
Technische Hochschule Darmstadt To find the answers to the questions
kunstmann@pu.informatik.th-darmstadt.de Were always in your own eyes.
http://www.pu.informatik.th-darmstadt.de/~kunstman Derek W. Dick
Re: Plotting functions in IDL [message #5619 is a reply to message #5513] Fri, 19 January 1996 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <4dgftr$1qr5@rs18.hrz.th-darmstadt.de>, kunstman@pu.informatik.th-darmstadt.de (Thomas Kunstmann) writes:
> What is the best way of plotting a function in IDL? As far as I know,
> it only handles vectors of discrete data and no equations.
>

I think what he is asking is whether IDL can plot "expressions" or "equations"
which are not known at the time a procedure is written, but rather are
determined at run time.

This is indeed possible in IDL, using the EXECUTE function. Here is an example
of an IDL program which does so, and the output of a session using it.

************************************************************
print, 'Enter expression to be plotted'
expression=''
read, expression
t = execute('plot, '+expression+', title=expression')
end
************************************************************

; IDL Version 4.0.1 (vms alpha)
; Journal File for CARS3::RIVERS
; Working directory: USER_DISK:[RIVERS.IDL]
; Date: Fri Jan 19 16:51:12 1996

.run test_plot
;Enter expression to be plotted
; sin(findgen(100)/10.)

The procedure then draws the plot of the user-entered expression.

____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
Re: Plotting functions in IDL [message #5635 is a reply to message #5513] Thu, 18 January 1996 00:00 Go to previous message
hahn is currently offline  hahn
Messages: 108
Registered: November 1993
Senior Member
kunstman@pu.informatik.th-darmstadt.de (Thomas Kunstmann) wrote:

> What is the best way of plotting a function in IDL? As far as I know,
> it only handles vectors of discrete data and no equations.

Yes, IDL need the data in tables, either in core or on disk.
Actuall, I'm glad that this avoids error, because you have to
think of how to fill the table. I.e. try the following with
mathematica:

Plot[Sin[x*x],{x,-3Pi,3Pi}]

you won't believe your eyes!

What mathematica does - and many other packages do - is to divide the
given intervall into equal pieces and call the function at the pivots.
But due to the periodicy and due to rounding errors the function
are neither symmectrical to the y axis nor are the extremes always
found. Thus in this case you have a dip in the amplitude at x=7.1.
The minimum y value is -0.3 rather than -1.

So you either think of how to fill the table that IDL should plot or
use some other graphics package and believe the results!

Norbert Hahn
TH Darmstadt
Re: Plotting functions in IDL [message #5643 is a reply to message #5513] Thu, 18 January 1996 00:00 Go to previous message
korpela is currently offline  korpela
Messages: 59
Registered: September 1993
Member
In article <4dgftr$1qr5@rs18.hrz.th-darmstadt.de>,
Thomas Kunstmann <kunstman@pu.informatik.th-darmstadt.de> wrote:
> What is the best way of plotting a function in IDL? As far as I know,
> it only handles vectors of discrete data and no equations.

First set up a range and then plot the function over the range.
The way I do it is, for example....

IDL> x=range(-3.*!pi,3.*!pi,0.01)
% Compiled module: RANGE.
IDL> plot,x,sin(x*x)

I have a function called range that looks like this.....
------------------------------------------------------------ ------------
Function range,lo,hi,delta

if (n_params(0) lt 2) or (n_params(0) gt 3) then begin
print,'RANGE-- Incorrect number of parameters'
return,-9999.0
endif
if (n_params(0) eq 2) then delta=1.0
number=long((float(hi)-float(lo))/float(delta))
outrange=float(lo)+findgen(number)*float(delta)
return,[outrange,hi]
end
------------------------------------------------------------ ------------

Eric

--
Eric Korpela | An object at rest can never be
korpela@ssl.berkeley.edu | stopped.
<a href=" http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpe la/w">
Click here for more info.</a>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL and color table allocation
Next Topic: Need Help Rendering Picture of Earth with Satellites

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:37:55 PDT 2025

Total time taken to generate the page: 0.00649 seconds