11-14-2010 08:29 AM
Hi altenbach and johnsold,
I have tried to fit a 2d array in the first loop. And as you said, I have indexed the array firstly and then plot the x-y graph. However, The x-axis of the curve is again the number of loop iteration from 0 to 13. However, the first column of the 2d array appears in the indicator as a probe locations of 1; 0.977; 0.955 ......0.284......0 etc. So, these values are not accepted as x-values by the specified program. But I want these values in the first column of the 2d array as x-values in the x-y graph and the second column of the 2d array as y-values. How can I achieve this? Could someone help to me? I have attached the picture that show the wrong x-y grpah according to identified 2d array elements and attached the last VI.
Please help me!!!! Thanks again to everbody who helps or does not help me!!!!
11-14-2010 01:52 PM - edited 11-14-2010 01:54 PM
As I already said, you need an xy graph. You also need to set the locations for the polynomial fit.
here's a cleaned up version, see if it makes sense to you.
11-15-2010 03:56 PM
Hi altenbach,
Thank you for your reply. I will try your solution and return back to you. Thanks again very much!!!
11-23-2010 03:49 AM
11-23-2010 10:19 AM
Use polynomial evaluation to calculate the function value for any possible x given the array of polynomial coefficients obtained earlier from the fit.
To graph an entire curve, create a ramp of x-values and do the same. See how far you get.
11-23-2010 03:49 PM
Hi altenbach!
I see the polynomial evaluation. However, it is not likely suitable for that I want to do. I want to obtain the equation itself. For example, y=2.01x2 -1.0002x + 3.89. And then I will multiply this equation with 2pi and x variable and then integrate it. Later, I will divide the result to otner constant and obtain a mean value. Shortly, I need the equation purely in order to process it mathematically. I do not need to calculate the function value for any x value.
I need the function itself. Then, in the same VI, I will integrate and/or multiply/divide the function. Please help me!!
11-23-2010 11:33 PM
mechen wrote:I see the polynomial evaluation. However, it is not likely suitable for that I want to do. I want to obtain the equation itself. For example, y=2.01x2 -1.0002x + 3.89. And then I will multiply this equation with 2pi and x variable and then integrate it. Later, I will divide the result to otner constant and obtain a mean value. Shortly, I need the equation purely in order to process it mathematically. I do not need to calculate the function value for any x value.
LabVIEW does not do symbolic math and I don't really understand what you actually want to do. But I am sure a numeric solution would work and could be easily done.
Do you integrate over x? What range of x?
11-24-2010 01:50 AM
Hi altenbach,
I will integrate the equation over x in the range between 0 and 0.133. So, what I want is that:
Now, we are able to fit a curve for 2D x-y array. So, we have a function/equation for this fit. If I wire an indicator "General Polynomial Fit.vi" to "Polynomial coefficients", I can see the coefficient in array indicator. But, I want to take the equation as an output form the vi like this: y=3x^2 + 2x -5 , etc. So, in the same vi, I will be able to process mathematically this equation. Firstly, ı will multiply this equation with x variable and the function will be : y=3x^3 + 2x^2 -5x . And then multiply it by 2*Pi. and it will be y= 2*Pi*(3x^3 +2x^2 -5x) . Then I will integrate it with respect to x variable in the range between 0 and 0.133 and find the flow rate as a value ,e.g., 0.234122 m3/s.
So, I need the function purely not only coefficients.
11-24-2010 04:08 AM
Try this. See if it makes sense.
11-25-2010 08:41 AM
Hi altenbach!
Thanks a lot for your reply. The program is now working very well. I have also one more question about write these result into a file. I tried it, however, somewhere I make mistake and do not succeed it. This is what I want:
I want to write a file like attached notpad. When I run the program and finish the run, I want to write the Reta, Reos, Frequency (f) and amplitude (A) value as a file name.
on the other hand, in the file, I want to see r/R values and corresponding uta and uos values. Moreover, at the top of each values, I want their headings in the first row like r/R, uta, uos.
As a conclusion, e.g., If I want to see the data which belong to f=0.5 Hz, Reta=800, Reos=400 and A=1, etc. , I will open the file named as "Reta=800; Reos= 400;f=0.5Hz;A=1". So, I will not make a mistake while searching the data form the data files.
Also, I want to store the pictures of best curve fits which are pointed in red circles in front panel picture in the attached file.
Could you please help me for these situations? Thanks again very much. I'm looking forward to hearing from you as soon as possible.