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

Home » Public Forums » archive » Re: How to calculate the abscissa values for the given vertical values
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: How to calculate the abscissa values for the given vertical values [message #68121 is a reply to message #68120] Tue, 06 October 2009 00:55 Go to previous messageGo to previous message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
On Oct 5, 6:26 pm, "Jean H." <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
> dux...@gmail.com wrote:
>> Y is a time series and X is the sampling time.
>> Both X and Y are discrete.
>> I don't know the analytical form of the relation bewteen X and Y.
>
>> To get the vertical value NY for a given time NX, I can use 'NY =
>> interpol(Y, X NX)'.
>> Similarly, I want to get the correspondent time CX for a fixed
>> vertical value CY.
>> But the values of correspondent time are not unique. CX should be not
>> a scalar but an array.
>> So I cannot use 'CX = interpol(X, Y, CY)' to get these values.
>
> You may do it by hand...
>
> x = findgen(1000)/1000*4*pi
> y = cos(x)
>
> Ytarget = 0
>
> ;Find the 2 consecutive points that are > and < of the Y threshold value
> ;(don't forget to deal where a point = the value)
>
> Xidx = where((y gt Ytarget and shift(y,1) lt Ytarget) or (y lt Ytarget
> and shift(y,1) gt Ytarget), count)
>
> then you can do a linear interpolation to find Xsolution
>
> ;y = ax+b
> a = (y[xIdx] - y[xIdx+1]) / (x[xIdx] - x[xIdx+1])
> b = y[xIdx]-a*x[xIdx]
> Xsolution = (yTarget - b)/a
>
> Jean

Thank you very much! ^_^
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Earn Free cash From DoEarn
Next Topic: rois

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

Current Time: Sun Oct 12 13:05:53 PDT 2025

Total time taken to generate the page: 2.15761 seconds