05-08-2012 07:56 AM
I have written a program that plots a graph, and I need that graph to have 3 seperate functions plotted on it. The actual program is for a sound response calibration for a microphone, and I will have 1 function that is the microphone response, 1 function that plots the upper allowable limit and 1 function the plots the lower allowable limit. Attached are my attempts to get the 2 limit functions plotted on the same graph, and I can't seem to make it work like I want it. My limits come from a .txt file in a table, and I have a sub.vi that reads and outputs the centerline, as well as how far up and down the data is allowed to go. I get the upper limit by adding the centerline and the upper tolerance, and I get the lower limit by subtracting the lower tolerance from the centerline.
In the 1st for loop, I tried to plot them both at the same time, and it looks like it plotted both functions, but didn't view them as 2 seperate functions, and I ended up with a sawtooth-type plot instead of 2 plots.
In the second/third for loops, I tried to plot them one at a time using a local variable but that didn't seem to work either, as I still only see 1 plot.
The end goal is to get 3 seperate plots (with 3 seperate legend bars!) on the same XY graph.
Thanks for the help : )
05-08-2012 08:33 AM
05-08-2012 09:15 AM
So I found a "Limit Testing.vi" and it seems like it should do what I need it to, but it has a bunch of other capabilities that I don't need that are making it unweildy for me. The upper and lower limits are clusters, (and maybe some sort of array?) but I can't get them to work right. I have no need for a dX or X0 limit, so I've tried multiple ways of just sending the Y max value, but none of them seem to work.
I did find a "Max and Limit Testing.vi" that doesn't have dX or Xo inputs, and I got it wired correctly, but when I send it's output to the graph I still end up with only 1 plot. It will tell me if I am outside the limits, which is useful, but it won't plot the limits.
05-08-2012 09:40 AM
05-08-2012 10:02 AM
Thanks for your help Ben, I am almost to where I need to be.
Using the example, I got the "tested signals" chart (shown in image) to plot the errors correctly, but it is a waveform chart, and I cannot input my frequency values for the X-axis! ...so that won't work.
I tried the exact same setup with the XY graph, but again, no limits, only 1 plot.
This seems like it should be an extremely easy fix, is there no simple way to add a second input to the XY graph? I don't really need all the extra analysis that comes with the mask and limit testing.vi, and simply adding a second input seems like a basic functionality that the XY graph should have.
05-08-2012 11:15 AM
05-08-2012 11:59 AM
Again, Ben, thanks for all your help.
I finally got it working, and attached an image to this post of what I needed to do.
It would certainly make things easier though if you could just expand the XY chart to add inputs just like you can the "build array" functions, though.
05-08-2012 12:06 PM
05-08-2012 12:14 PM
ugh, ok I just realized something.
This will work, but I lose the ability to reset the graph when I take away the "build XY graph."
So... riddle me this, Batman. The loop on the bottom of the attached image works, and produces the correct graph with 3 functions plotted (but again, no ability to reset the graph).
The loop on the top, however, won't plot anything at all, it is just blank. The reset is a control, and when false (it's default setting) it SHOULD work just like the one without the build XY graph... except it doesn't.
05-08-2012 12:28 PM
My suggestion is to open the front panel of the Build XY Graph express vi and to replicate the code to reset the graph (do not save modification of the express vi). Basically what it does is to reinitialize the graph with an empty array of type cluster of numeric array.
Ben64
note: the inner arrays do not show up well in a snippet!