04-18-2020 05:24 PM
I need to plot iterations of a subVI over a finite range of iterations and retain the old data on the plot. The subVI takes the inputs and runs them through the following calculation:
The value of R_2 is constant at 470 ohm, V_in is constant @ 4V, and the variable B is constant at 50. The only input into the subVI that should vary is R_photo, which should be between 5-1000 ohm. Although the Waveform Graph does update if I run the VI and start changing variables, I'm pretty sure it should not be graphing a straight line. The X-Y Graph does not display anything at all.
This is my VI:
And this is the subVI:
At a later point, I am also going to want to add a plot of the sensitivity (Lumens/ohms).
Solved! Go to Solution.
04-18-2020 07:05 PM
You are not understanding shift registers. If you want to build your array in a shift register, i.e. add the new element to the array coming from the previous iteration coming out of the left shift register terminal. There are plenty of examples in the forum how to do that.
Even simpler: remove the wait and autoindex at the right loop boundaries (no shift registers needed). You don't really need to see anything during the loop, right. Also, remove the wait.
(Also, since you know the number of iterations before the loop starts, you need a FOR loop, not a while loop. All your terminals should be orange)
04-19-2020 12:05 PM
I've gotten the basic function and plot to work:
Now I'm trying to figure out how to take the derivative of the first graph and plot it as a second graph.
04-19-2020 12:29 PM - edited 04-19-2020 01:20 PM
Good. Now it's time to simplify.
04-19-2020 12:37 PM
This is my code so far....
04-19-2020 01:33 PM
Your derivative is more complicated, because dx is NOT constant. Here's what I would do: (just simple pairwise difference).
(The complex array has RE" x, IM:y, so if you subtract an array shifted by one, you get RE: dx and IM:dy and it is easy to approximately calculate dy/dx)
04-19-2020 02:56 PM
Got it working...thank you! What is the best way to analyze the data from the Sensitivity graph? Say if I wanted to find the sensitivity at a specific number of lumens or determine the corresponding number of lumens from a certain point on the sensitivity graph? When I try to wire the data that is being plugged into the XY Graphs to a Write to Measurement File Express it doesn't work. Is it because it is a complex double?
04-19-2020 03:09 PM
Well,
04-19-2020 04:10 PM
@altenbach wrote:
- writing to a file requires a 2D array, instead.
Here's how to write a file with three tab delimited columns:
04-19-2020 04:13 PM
I got the wires to work to the Lumens per Ohm file express, but the file is only writing data for one x and one y value (the final one), even though I wired it up exactly like the Lumens vs Ohms above it. Also, why would I need to inerpolate the sensitivity when the sensitivity is already the derivative of the Lumens vs Ohms graph? The y-value of the Sensitivity Graph should be the slope of the Lumens vs Ohms graph.