LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

interpolate 1D ntimes

I have a vi where a Gaussian-like curve is recevied, an interpolation is done, a Gaussian fit is performed on the interpolated curve, & then the power spectrum of the signal is calculated.
In the Interpolate1D.vi, I leave xi unwired & use ntimes to specifiy the number of interpolated locations between successive points in the original Gaussian-like curve.
I noticed that when I change the value of ntimes, say from 5 to 6, the resulting Gaussian fit remains essentially the same (a good fit), but the power spectrum changes alot. I don't understand why ?
Does anyone have any experience with this & the general problem of how to properly obtain the frequency response from a Gaussian signal ?

Thanks,

ak

0 Kudos
Message 1 of 12
(3,298 Views)
Can you give us an example? What is "a lot"?
0 Kudos
Message 2 of 12
(3,291 Views)
Yeah sure - attached is a vi illustrating the problem. Adjust ntimes from say 5 to 10 & watch the MTF curvechange drastically, even though the Gaussian fit hasn't changed at all ?

I may be missing something simple - any help would be greatly appreciated.



0 Kudos
Message 3 of 12
(3,279 Views)
Well, you are calculating a power spectrum, but then graph it against the old time (or distance) axis instead the new frequency axis.
 
Easiest would be to use a plain graph, calculate the old dt, then use the df output of the power spectrum to set the increment of the X-Axis.
 
See attached quick modification draft (LabVIEW 8.0). I took the liberty to eliminate the stacked sequence and local variable. They did not serve any purpose except making the code hard to read and debug. ;))
 
Modify as needed. 😄
0 Kudos
Message 4 of 12
(3,268 Views)
Of course the fourier transform of a Gaussian is another Gaussian, so calculating the resulting power spectrum (width etc.) is trivial. No transform needed. 😉
 
 
 
0 Kudos
Message 5 of 12
(3,258 Views)
Thanks for the example. I guess I'm still not clear on a few thinigs :

What I observe is that the MTF data array & graph do not agree & that changing ntimes still changes MTF data array.
I don't understand the point of the df output for scaling the x-axis; it doesn't seem to reflect the MTF data;
it's Y values & X values are fixed ?

I'm back to the original problem that changing ntimes drastically alters the MTF data array even though the Gaussian fit
(which is FT'ed to get the MTF data) doesn't change ! (see edge analysis plot or just observe the standard deviation indicator).

ak


0 Kudos
Message 6 of 12
(3,248 Views)
In my quick modification, I only modified the graph axis, not the MTF data array, which is still incorrect.
 
If you do a power spectrum, you need to transform the x-values! If you change the sampling rate (and that's what interpolation does!), you need to account for that in the transform. (If you don't the tranformed x-axis "seems" to expand or contract.)
 
A good place to start would be http://zone.ni.com/devzone/cda/tut/p/id/4541
Let me know if you have any more questions. 🙂
Message 7 of 12
(3,244 Views)
Argh, still confused. Attached is one of the mods that I thought would work -  scaling the MTF x-values by df. What is the correct scaling ?

Also, I don't see any difference whether the XScale Multiplier property node is used or removed from the VI ?

0 Kudos
Message 8 of 12
(3,233 Views)
Yes, this is absolutely right, the increment needs to set only once. It will remain constant since your lowering of dt of the raw data is completely compensated by an increase in N.
 
An interpolation in the time domain basically translates to a zero-filling in the frequency domain. The early points will be the same in the transform, and they are within a few percent. See attached. Agreed? 🙂
 
Is that what you mean by "changes alot"? There is no reason they should stay exactly the same, because you are interpolating, thus adding data.
 
 
 
 
0 Kudos
Message 9 of 12
(3,229 Views)
I must not be explaining it right. Attached is a practically identical vi (I've multiplied the MTF data by a constant so I can lift the values away from near 0).

All I care about is the MTF data array - I don't understand the plot - it is misleading to me.
Run the vi & simply observe the 10th element of MTF data array.
When ntimes = 5, it is 7.26; when ntimes = 10 it is 0.23 . I don't understand why the difference. The Gaussian fits in both cases are identical.

Something must be wrong in my code - maybe you can show me explicitly how you would change it get a constant MTF array independent of ntimes ?



0 Kudos
Message 10 of 12
(3,224 Views)