From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fine-tuning of xy graph

Hi, the screenshot below shows the XY Graph that I currently have in my VI, what I wish to know is that is there anyway that I can fine-tune it so that the results on the XY Graph would be an straight line and not some random line?                         

 

 

 

                                 , xy Graph.jpg 

 

Hope to receive your prompt replies. Thanks.

0 Kudos
Message 1 of 10
(3,785 Views)

@fredteng wrote:

 I can fine-tune it so that the results on the XY Graph would be an straight line and not some random line?                 

 

 

 

                                 ,  

 


What do you mean by wanting a straight line instead of random line in your plot? Plot represents the data you fed in and a linear data would give you a straight line. Please elaborate your question.



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 2 of 10
(3,777 Views)

It has nothing to do with the graph and everything to do with the data the you connect to the graph.

 

To get a straight line your data needs to represent points which fall on a stragiht line.  Try (0,270), (50,270), (100,270), (150,270), (200,270), (250,270).

 

The graph is to help you see what your data is like.  If you do not get the results you expect, then you need to look at the data or what generates the data to see why it is not linear.

 

Lynn

0 Kudos
Message 3 of 10
(3,776 Views)

As you can see from my screenshot, there is a sudden dip from about 300 to 160, so is there any way that I can stop it from decreasing and keep it increasing so as to make the curve as smooth as possible.

Thanks.

0 Kudos
Message 4 of 10
(3,761 Views)

Yes.  Feed it data that doesn't do that.

 

You haven't provided any information on what this data means, where you are getting it from, or why it isn't what you want.

 

0 Kudos
Message 5 of 10
(3,757 Views)

Attached below is my VI and its sub vi. The x - axis of the graph would be the Graylevel value I obtain in my VI and the y-axis would be the maximum data at which angle value I obtain in my VI. The maximum data at which angle value is retrieve from an ellipse but sometimes 2 of the points of an ellipse might be similar and so the computer would decide which point to choose and thus causing the graph to have a sudden dip. So how do I make sure that the computer choses the right point from the ellipse so that I would have a smooth curve?

Thanks. 

Download All
0 Kudos
Message 6 of 10
(3,755 Views)

Well, how do you choose which is the right point on the ellipse? The data set you posted has a noise peak on the curve at ~75 degrees on the graylevel 25 file while the highest peak is >250 degrees on the others.  When you use the simple Array Min Max you are going to get the highest value in the whole array and the program will not know that you think that is the wrong peak.

 

I tried several things: First I graphed the amplitude data to see what was going on.  That is how I noticed the noise peak mentioned above.  Then I observed that for the data set you posted there were always two peaks, and from the polar plots it seemed likely that that would always occur. Further is seems likely that the peaks are approximately 180 degrees apart except for noise effects.  So I split the data array at the midpoint and found the maximum in each half and plotted them separately.  These plots seem to track what you expected fairly well. See the image below.  This will probably not work for some data sets where the peak is near 180 degrees.

 

Other issues with your program:

1. You read the same files 4 times!!!!  Your sample files are not large but it rarely makes sense to do the same thing over and over.  Read them once and recycle the data. If all your data files are as small as these, you can easily keep all the data in memory.  A bit of bookepeing may be required for your sorting, but I would do that before I read the files 4 times.

2. You can take the string you read to find the graylevels and and convert the data portion to an array using the Spreadsheet String to Array function. Once.

3. Once you have used Array Subset and Index Array you can use the same data several places rather than repeating the functions and allocating new memory spaces for the arrays.  For example the data fed to the Polar2.vi at the top of the for loop is the same as the data connected to Array Max & Min at the bottom.  Just run wires from one source to both places.

 

You can probably simplify some other things as well, but those are the obvious ones.

 

Lynn

 

Separated peaks.png

0 Kudos
Message 7 of 10
(3,732 Views)

I can't tell the computer whether the point it chooses is the right peak. But what I can do is to look at the curve produced by the xy Graph and see if there is any point that is about 180 degrees apart from the other points in the curve. I would then have to add 180 to this point so that it fits nicely with the other points to form a smooth curve and not a curve that has one or more point that is about 180 degrees lesser than all the other points. So how would you suggest I do that? 

0 Kudos
Message 8 of 10
(3,728 Views)

If you look at the graphs I posted you can see that the upper graph shows the amplitudes of the two peaks.  At Graylevel 25 the first peak has a higher level than the second peak. This is the one which produces the big dip on your XY graph.  The lower graph shows the first peak angles in yellow and the second peak angles in white.  Note that the white graph is the same as your XY Graph except at Graylevel 25.

 

I will clean up what I have tried a bit and post it later today.

 

Lynn

0 Kudos
Message 9 of 10
(3,721 Views)

It took a bit more than a little cleaning.  I tried to add notes on the block diagram describing what I did and why.

 

Lynn

 

 

Message 10 of 10
(3,714 Views)