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

Home » Public Forums » archive » partial differential equation
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: partial differential equation [message #93987 is a reply to message #93985] Tue, 13 December 2016 09:35 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Tuesday, December 13, 2016 at 12:18:32 PM UTC-5, AGW wrote:
> On Tuesday, December 13, 2016 at 10:49:42 AM UTC+2, AGW wrote:
>> Hi,
>>
>> If
>> lm=[623.2,624.5,665.3,778.2]
>> S=ss[0:300,0:400,0:18,0] ;;; an image
>> compute
>>
>> x=∑[(∂^2 (s))/(∂(lm)^2)] ;;; image
>>
>> How can I do it using IDL?
>
> lm have 19 value, but I did not write all values, suppose
> lm=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
>
> else
> x=∑_i[(∂^2(s))/(∂ lm^2 )]]_i


Well, it's easy and it's hard. If you read the Wikipedia article about finite differences, it's easy. The expression for finite differences is,
∂^2(s))/(∂ lm^2) = ( s(lm+h) - 2 s(lm) + s(lm-h) ) /h^2
That's easy to express in IDL,
d2s_dlm2 = s*0 ;; Initialize to blank array
for i = 1, 17 do begin
h2 = (lm[i]-lm[i-1])*(lm[i+1]-lm[i]) ;; compute h^2 term
d2s_dlm2[*,*,i] = (s[*,*,i+1]-2*s[*,*,i]+s[i-1]) / h2
endfor

Note that it's not possible to compute the finite difference second derivative at the first and last LM position because there's not enough data to estimate it.

Now you want to sum it. That's easy too,
x = total(d2s_dlm2,3)

But the problem is that the sum of a second derivative is more or less equivalent to the integral of a second derivative, i.e. just a single derivative. It's really equivalent to computing the mean slope of S. You don't have to do any of the second derivative stuff to do this. You should basically get the same answer by doing,
x = (s(*,*,18) - s(*,*,0))/(lm(18)-lm(0))
This is not quite true if LM is unevenly spaced.

So you really have to decide if this is what you want.

Did you mean to take an absolute value? Or square the second derivative before summing it?

CM
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Partial Differential Equation
Next Topic: histogram problem

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

Current Time: Wed Oct 08 13:07:38 PDT 2025

Total time taken to generate the page: 0.00409 seconds