LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a chart with two variables (not time on x-axis)

This may be a simple question, but I can't seem to figure it out.

 

In my program, I am measuring an experimental voltage (Vresis). I am dividing that voltage by a numeric constant of resistance (Resistance) to get the current that goes through my one-loop circuit. I am able to chart the current vs time on a standard waveform chart. 

 

I am also taking in another voltage, (delta V 1-2). I want to chart my current on the x-axis and voltage (delta V 1-2) on the y-axis in order to find the slope and y-intercept of that graph. 

 

1. How can I chart the two variables against each other, making it so I have a variable other than time on the x-axis?

2. How can get my program to identify the y-intercept of the voltage (delta V 1-2) vs current graph to use for other calculations?

 

I have included screenshots of my entire labview program below. I am a beginner, so any tips or comments would be greatly appreciated!

charlotte99_0-1728659563659.png

charlotte99_1-1728659608916.png

charlotte99_2-1728659717316.png

 

0 Kudos
Message 1 of 9
(316 Views)

Sorry, we don't do screenshots. Please attach your VI (save for previous, 2020 or below first)

 

(You attached 3 different pictures showing at least seven charts. How are we supposed to figure out what you are talking about!)

 

The x axis is labeled "time" by default, but can be named anything of course, as long as the points are spaced equally.

 

To graph Y vs X, where X and Y are randomly spaced, you need an xy graph. If you want to graph the x,y position as a trajectory updated in time, you need to build the data in a shift register. Simple!

0 Kudos
Message 2 of 9
(310 Views)

I have linked my VI below. Thank you!

0 Kudos
Message 3 of 9
(303 Views)

You did no "save for previous". It is still In LabVIEW 2023.

0 Kudos
Message 4 of 9
(299 Views)

I apologize. Please let me know if this is in an earlier version.

0 Kudos
Message 5 of 9
(294 Views)

Here's a simple example graphing two values against each other as a function of time.

 

altenbach_0-1728661404137.png

 

0 Kudos
Message 6 of 9
(282 Views)

1 To plot xy you need to bundle 2 arrays (your delta V1-2) and the Current array and bundle to plot on a XY graph. 

LVNinja_1-1728663655329.png

 

2To calculate the y intercept play around with a function Liner fit, pass voltage as Y and current array as X. 

 

LVNinja_0-1728663436370.png

 

0 Kudos
Message 7 of 9
(262 Views)

@charlotte99 wrote:

I want to chart my current on the x-axis and voltage (delta V 1-2) on the y-axis in order to find the slope and y-intercept of that graph. 


This assume that there is a linear dependence between the two sets and you have at least two point. Is this a valid assumption?

 

In that case, you can just feed the data to "linear fit ptbypt" and get a display of slope and intercept updated as more data arrives. You could even chart these outputs.

 

About your code.

  • Why is the front panel and diagram maximized to the screen with controls scattered over a large area (e.g. the controls for the various waits that all seem to be 250ms).
  • Why are there so many wire bends and overlapping code elements?
  • Why are there five (five!!!) stop buttons screens apart?
  • Why can't you combine the lower three loops into one if they all spin at the same rate?
  • Do you really need to create and destroy two virtual channels with every single iteration of the top loop?
0 Kudos
Message 8 of 9
(256 Views)

"This assume that there is a linear dependence between the two sets and you have at least two point. Is this a valid assumption?" 

 

Yes, that is correct.

 

I took your advice to revise my code, as I have linked below.

 

What do you mean by "create and destroy two virtual channels with each iteration of the top loop"?

 

0 Kudos
Message 9 of 9
(163 Views)