10-19-2017 10:42 AM
Dear all,
I have two arrays-1D with complex number. and I want to do interpolation between these two arrays. I found some examples but they were real number and I am having complex numbers. Thus, I am wondering if there is someone can help me to sort out this issue?
More information in the attached thread.Thanks in advance
Best regards
10-19-2017 10:51 AM
Just so I am clear, what does it mean to interpolate a complex number? If you want a value halfway between (2 + 2i) and (4 - 4i) would it be (3 - 1i)?
10-19-2017 11:22 AM - edited 10-19-2017 11:30 AM
All your VI has is two complex arrays so it is not clear what you actually want. As has already been mentioned, you need to define what "interpolate" actually means in your case.
10-19-2017 01:08 PM - edited 10-19-2017 01:16 PM
Besides interpolating Re and I'm independently, you might instead want to interpolate the phase and magnitude independently. You have to decide if he phase is interpolated clockwise, counterclockwise or smallest path. This is very resemblant of how a dds ramps up amplitude and\or phase. Or interpolating colors in hsl space. Don't think it makes sense in this situation though.
I'd think you want to interpolate x and y values. It won't do you any good. The interpolated values will be on the straight lines already drawn, you'll just get points on that line.
I think you need some sort of 2d curve fitting instead.
10-19-2017 02:05 PM
The OP's description of the problem (suggested also by the title) is to interpolate between two complex arrays. The "natural" way to think about this is the result will be another 1D array whose value is Result = (1-k)*A + k*B, where A and B are the original arrays, and k is a value between 0 and 1 (if k = 0.5, you'd get the mid-point between A and B). Looking at the data that Altenbach kindly posted, these curves have very similar character, but are displaced and rotated slightly.
Bob Schor
10-19-2017 02:26 PM - edited 10-19-2017 02:43 PM
I'd guess the intention is to make a smoother curve. Interpolation won't help.
So simply interpolation between all Re values of the first and second array, and I'm values of both would be useful. If the first array is a measurement, and the second is a measurement too, the result would be a measurement in between.
That would simply be a matter of
1) split the array1 in Re and I'm arrays (complex to Re\Im)
2) split the array2 in Re and I'm arrays (complex to Re\Im)
3) Interpolate between array1.Re and array2.Re
4) Interpolate between array1.Im and array2.Im
5) merge the results with Re\Im to complex
3) and 4) is simply (b-a)*I+a.
Might post a vi tomorrow if nobody done so by then.
10-19-2017 02:37 PM - edited 10-19-2017 02:44 PM
Well, he could do a spline on RE and IM as a function of array index (e.g. time) with 10x more points. (example)
10-20-2017 03:04 AM - edited 10-20-2017 03:05 AM
Well, here's what my assumed solution looks like. Slide=0.2.
Would be nice to get any feedback on what OP wants...
10-20-2017 11:03 AM - edited 10-20-2017 11:07 AM
10-20-2017 11:29 AM
Looking at Christian's lovely Spline drawing, it suddenly came to me what "interpolation" might mean (or certainly a case where it could be useful). I'd noted earlier when I saw the original plot that these two curves looked similar. So let's assume that they represent a set of ordered points (perhaps coordinates of a path on the surface of some deformable object). Let me further assume that I take two "snapshots" of these points at time T0 and T1, and I'm interested in how the underlying object "evolves" over time. So I divide the elapsed time, T1-T0, into N intervals, and make a movie where the first frame is the curve at time T0, Frame N+1 is the curve at time T1, and intermediate frames are interpolations between the two curves at position i/N (hmm, I may have an "off-by-one" error here, but you get the idea). As you watch such a movie, you'll see it start with one curve, the smoothly translate, rotate somewhat, and maybe get some distortion, ending up as the second curve.
It is an entirely separate question if this is a sensible thing to do, and if this is what the O.P. is trying to accomplish ...
Bob Schor