01-26-2011 08:33 AM - edited 01-26-2011 08:40 AM
Hi all,
I created a simple Vi to perform interpolation using Both Spline and Polyfit, and manage to output the interpolated data. HOWEVER, i am unable to plot the data on a chart and compare the interpolated data with my known waveform.
Also, am i using the right block for spline interpolation ? As I come across to spline point by point too, However, I think that the two Spline blocks that I used in the Vi is the right one, but just that I am having some difficulty in plotting the data correctly.
Attached is my VI and also the pre generated waveform that need to insert into the sine input BOX in the VI
Pleases suggest or help
Thank you
01-28-2011 12:15 AM
Hi,
It seems like you have a memory leak somewhere in your program. Is there any reason why you have decided to pass data using a global variable? Can you run just the subVI that you are using via a VI Server call by itself without the memory error? If so, the issue might lie in the way you are passing data to the main VI.
01-28-2011 02:31 AM
@Sanjay C. wrote:
Is there any reason why you have decided to pass data using a global variable? Can you run just the subVI that you are using via a VI Server call by itself without the memory error? If so, the issue might lie in the way you are passing data to the main VI.
Sanjay, I don't see any local variables, subVIs, or VI server calls anywhere in the VI attached above. Could it be you replied in the wrong thread?
Edwingtr34, I don't understand your program. What is the purpose of the chart? I don't think a chart is the right indicator for this. What exactly do you want to show?
The spline interpolant inputs do not change during the duration of the loop, so you should do that once before the before the loop. (I am not sure if the compiler can recognize it as loop invariant code the way you have it currently wired)
01-28-2011 07:51 AM
What I trying to do are:
Split the pre generated waveform, Y(i)- (white line on the chart) into every 100 point (red X on the chart), so that I will only have the point of every 100 cycles, as shown in the array name “Obtained feedback”
Then, I added one more point,Y (i+100) ,of the known waveform, by just adding 100 into the index of my pre generated waveform, and then put into the array name “The points that used to interpolate the curve”. The goal of adding Y(i+100) is to use to emulate the prediction of the path from Y(i+1) to Y(i+99) ahead of time.
Thus, the goal of the VI is to first interpolated the points in “The points that used to interpolate the curve” then compare each interpolated data and the known waveform (white ) with respect to each index so that I can also calculate the error between them. It does not have to be plot on the chart, but I wanted to have a visual aids to show both the waveform and the points used to interpolated the wave.
I apologized ahead of time, but I am still new to LabView and also the spline function, so if anyone can please give me some pointers or some modification of the VI to get this running, it will be greatly appreciated.
Thanks
Ed
01-31-2011 02:47 PM
Hi,
@ Altenbach: Yes, I think I posted my comments on the wrong forum! That's what I get for the rapid Ctrl-Tabbing this time.
Edwingtr:
I was able to plot the signal properly on the chart you have on the second row titled 'Interpolated Data'. I did this by replacing the waveform chart with a waveform graph. I believe the reason this worked is that all that data you need to display has been computed and is ready, making the waveform graph the appropriate choice. The waveform chart is for cases in which you need to continually plot new incoming data.
I don't think I'm completely clear on the issue that you are facing presently. You seem to be properly:
1. Extracting the interpolated data (as per the 'Interpolated Data' array on the front panel)
2. Plotting red X's every 100 points
If I'm not wrong, all that remains now is to find the error between the original waveform and the interpolation. I believe this can be done by subtracting the value from the appropriate index on the original from a value in the array of interpolated data.
Can you please describe more specifically the issue that you are currently facing so that we can isolate and address the problem?
02-01-2011 07:21 AM
Sanjay,
Yes, you are right , i can plot it on a graph which I had tried before.However, the goal to plot it on the chart so that I can compare them, at the same time if I have all the data of each index then I can also compare the data of my original data vs the interpolated data.
I kinda see where is the problem is now, is that If I index the Interpolated data, it will only index is at 0, 100, 200, 300, but not 0 1, 2.....100, 101...200 and so forth.
I am still trying to see how I can index every interpolated data that is generated by the spline function in that "interpolated data array" with respect to it index instead of only every 100th
Cheers,
Ed
02-01-2011 07:21 AM
Sanjay,
Yes, you are right , i can plot it on a graph which I had tried before.However, the goal to plot it on the chart so that I can compare them, at the same time if I have all the data of each index then I can also compare the data of my original data vs the interpolated data.
I kinda see where is the problem is now, is that If I index the Interpolated data, it will only index is at 0, 100, 200, 300, but not 0 1, 2.....100, 101...200 and so forth.
I am still trying to see how I can index every interpolated data that is generated by the spline function in that "interpolated data array" with respect to it index instead of only every 100th
Cheers,
Ed
02-02-2011 05:30 PM
@Edwingtr34 wrote:
I am still trying to see how I can index every interpolated data that is generated by the spline function in that "interpolated data array" with respect to it index instead of only every 100th
Hi Ed,
By default, all the elements in the interpolated data array are indexed starting at 0 and incrementing by 1 (0,1,2,...). I think the issue is that on each iteration, you're having to plot a value on the chart even though you're pulling out a value for interpolation every 100 data points. Perhaps it's a matter of putting the comparison into another loop?