Making array out of sinc [message #72262] |
Fri, 27 August 2010 04:00  |
sirvival
Messages: 18 Registered: August 2010
|
Junior Member |
|
|
Hi,
I want to create an array out of two sinc function.
My code looks like this right now:
;sinc psf
x=findgen(201)-100
psfx3=DBLARR(N_ELEMENTS(X))
for i=0, n_elements(x)-1 do begin
if x(i) eq 0 then begin
psfx3(i)=1
endif else begin
psfx3(i)=sin(x(i))/(x(i))
endelse
endfor
y=findgen(81)-40
psfy3=DBLARR(N_ELEMENTS(y))
for i=0, n_elements(y)-1 do begin
if y(i) eq 0 then begin
psfy3(i)=1
endif else begin
psfy3(i)=sin(y(i))/(y(i))
endelse
endfor
psf3=psfx3#psfy3
psf3=psf3/total(psf3)
plot,psfx3
stop
plot,psfy3
stop
shade_surf,psf3
end
The result is not what I am looking for.
I want something that looks like when raindrop hits water.
So when I do a contour plot it looks like elipsis.
How can I do this?
Thanks
PS: I use IDL 7.1. Not sure when IT will upgrade to 8.0
|
|
|
Re: Making array out of sinc [message #72334 is a reply to message #72262] |
Sun, 29 August 2010 09:56   |
Wout De Nolf
Messages: 194 Registered: October 2008
|
Senior Member |
|
|
On Sat, 28 Aug 2010 04:42:43 -0700 (PDT), sirvival
<fpfeifer@hs.uni-hamburg.de> wrote:
> On 27 Aug., 13:32, Wox <s...@nomail.com> wrote:
>> On Fri, 27 Aug 2010 04:00:40 -0700 (PDT), sirvival
>>
>> <fpfei...@hs.uni-hamburg.de> wrote:
>>> I want something that looks like when raindrop hits water.
>>> So when I do a contour plot it looks like elipsis.
>>> How can I do this?
>>
>> nx=201
>> ny=81
>> ratio=1.
>> x=rebin(findgen(nx)-nx/2,nx,ny,/sample)
>> y=rebin(findgen(1,ny)-ny/2,nx,ny,/sample)*ratio
>> r=sqrt(x*x+y*y)
>> psf3=sin(r)/r
>>
>> This gives circles as contours. Change the "ratio" to make ellipses.
>> Btw, this is not a 2D sinc function. That would be sin(x)sin(y)/xy.
>
> Hi,
> thanks alot.
> Thats what I am looking for.
>
> PS: Is my psf3=psfx3#psfy3 not equal to your sin(x)sin(y)/xy?
Yes it is, I didn't pay attention :-). My point was that if you need a
2D-sinc function, sin(x)sin(y)/xy is it, not the "raindrop function"
you ask for.
|
|
|
Re: Making array out of sinc [message #72501 is a reply to message #72334] |
Tue, 07 September 2010 08:21  |
sirvival
Messages: 18 Registered: August 2010
|
Junior Member |
|
|
On Aug 29, 6:56 pm, Wox <s...@nomail.com> wrote:
> On Sat, 28 Aug 2010 04:42:43 -0700 (PDT), sirvival
>
>
>
> <fpfei...@hs.uni-hamburg.de> wrote:
>> On 27 Aug., 13:32, Wox <s...@nomail.com> wrote:
>>> On Fri, 27 Aug 2010 04:00:40 -0700 (PDT), sirvival
>
>>> <fpfei...@hs.uni-hamburg.de> wrote:
>>>> I want something that looks like when raindrop hits water.
>>>> So when I do a contour plot it looks like elipsis.
>>>> How can I do this?
>
>>> nx=201
>>> ny=81
>>> ratio=1.
>>> x=rebin(findgen(nx)-nx/2,nx,ny,/sample)
>>> y=rebin(findgen(1,ny)-ny/2,nx,ny,/sample)*ratio
>>> r=sqrt(x*x+y*y)
>>> psf3=sin(r)/r
>
>>> This gives circles as contours. Change the "ratio" to make ellipses.
>>> Btw, this is not a 2D sinc function. That would be sin(x)sin(y)/xy.
>
>> Hi,
>> thanks alot.
>> Thats what I am looking for.
>
>> PS: Is my psf3=psfx3#psfy3 not equal to your sin(x)sin(y)/xy?
>
> Yes it is, I didn't pay attention :-). My point was that if you need a
> 2D-sinc function, sin(x)sin(y)/xy is it, not the "raindrop function"
> you ask for.
Hi,
I confused myself when I did try out your solution at home.
I took a closer look today and its not what I was looking for (so yes
I am not looking for a raindrop).
I dont know how to describe it.
I want two sincs. One is in x direction one is in y direction.
Now I want to move 2D.
Like a rotating sinc but not circular since x and y direction are
different.
I got an idea in my head and will try it out.
Thanks
|
|
|