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

Home » Public Forums » archive » Re: PLOT question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: PLOT question [message #22971 is a reply to message #22970] Wed, 20 December 2000 16:01 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Stuart Colley <src@star.ucl.ac.uk> writes:

> I have some data that is periodic, y=f(t) and the data is plotted as
> plot, t, y The problem is I'd like t to plot phase angle rather than
> time, the problem being the phase angle is between 0 and 1 and repeats.
> Attempting to plot the data you just get a plot between 0 and 1, what I'd
> like to be able to plot is each cycle of the data with it's phase angle.
>
> Any ideas on how to get the plot axes right?

It's not clear to me that everybody else is going waaaayyy overboard
here. Stuart hasn't responded so that may be a good or a bad sign.

Are you just asking how to convert linear time into phase? Perhaps
this is best accomplished with the MOD operator. If your signal has
period P, and the starting epoch is T0, then this may do the trick.

phase = (t-t0)/p MOD 1
phase = (phase+1) MOD 1
plot, phase, y

The "MOD 1" takes the remainder when divided by 1, or simply the
fractional value. The "extra" MOD step there is because MOD doesn't
handle negative numbers very well. It maps the segment from -1 to 0
back onto 0 to 1. Another way to do it in one step is

phase = (t-t0)/p
phase = phase - floor(phase)

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: temporary() pitfall
Next Topic: PV-WAVE

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

Current Time: Fri Oct 10 22:06:52 PDT 2025

Total time taken to generate the page: 0.31556 seconds