Wave length & wave reference question

I read (though I can't find it now) that make and duplicate do not create wave references when using the $. (see below for duplicate example). I don't really have a grasp of what this means, but wonder if it is the reason the below code works. I duplicate input, which has length 418, and set it to be the wave associated with the string ftemp (is this a reasonable way to think about this? it's how i phrase it in my head). I then set f to be the local wave variable, so that I can manipulate the wave associated with $ftemp. At this point, I would guess f should still have 418 length. But then I set the output of a Fourier transform to f. The output has length 204.

I'm wondering why this works.

Is it 1. Because the duplicate command didn't assign a wave reference? And what does that mean in this context? 2. The FFT will adjust the destination wave if neccesasry? 3. Something else?

function fbw(input, stepsize)
wave input
variable stepsize
string ftemp = nameofwave(input)+"_FFT"
duplicate/o input, $ftemp
wave f = $ftemp
FFT/OUT=3/DEST=f input
end              
This is pretty curious. If you execute:
make/O/N=418 ddd=sin(2*pi*x/10)
FFT/out=3/Dest=foo ddd
print numpnts(foo)

You should get: 210

The next curiosity is why you are bothering to create a wave for the destination? The whole idea for /DEST flag is to be used as above, i.e., you do not have to create the output before you execute the transform. If you specify a destination which already exists, it does not really matter how many points are in this wave. As long as you are not trying to pass a Text wave to /DEST, the wave is overwritten with the appropriate number of points for the transform. For a real wave input of N points, the transform is (1+N/2), which in this case is 1+209.


A.G.
WaveMetrics, Inc.
Ok, first mystery resolved. I must have changed either the 418 wave or the 210 one since calculating them. I read the rows of each wave from the data browser, and they were as I said (418, 204). But upon running the calculation again, I find what you found (418, 210).

I am creating a destination wave because I wrote a general piece of code where I can choose my time trace wave and Fourier transform it, with the output automatically being called input_FFT. I wasn't aware of an easier way to do this. Is there?
Igor wrote:
If you specify a destination which already exists, it does not really matter how many points are in this wave. As long as you are not trying to pass a Text wave to /DEST, the wave is overwritten with the appropriate number of points for the transform.


Thank you, this answers my question. I just tried it with a complex transform, and it doesn't seem to matter if the destination was real...it becomes complex when the FFT command executes.