LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting functions in 2D array on a Graph

Solved!
Go to solution

Hey all,

 

 

As an exercise I am trying to plot 2 functions placed in a 2D array on a graph, but for some reason the graph is only showing one of them.

The functions are : y = 5x+10 and y = 6x - 10.

I really don't see what I am doing wrong here, could anyone give me some more insight?


Thanks in advance,

Michiel

0 Kudos
Message 1 of 6
(3,273 Views)
Solution
Accepted by topic author TheAlPaca

Based on your code, I think what you really want to use is a Chart, not a Graph.  A chart keeps a history, so it just keeps adding on to the data.  A graph will get overwritten each time you write to the terminal.  So you were only graphing a single point for each plot.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 6
(3,268 Views)

Al,

 

To explain a bit more of what is going on, you have two functions

 

y1 = 5x+10

y2 = 6x - 10

 

Each loop of your application you receive two outputs;

 

y1(Numeric) = A

y2(Numeric) = B

 

You build an array such that you have [A,B].  When you plot the graph you then draw a line between points {0,A} and {1,B} because LabVIEW's default behavior is to use the indeces of the array as the x-coordinates

Matt J | National Instruments | CLA
Message 3 of 6
(3,255 Views)

Oh okay I get it, how can I prevent this from happening and just show A & B on their own?

0 Kudos
Message 4 of 6
(3,239 Views)
Solution
Accepted by topic author TheAlPaca
As already mentioned, a chart is a better option and you would bundle the two outputs, not build a 1D array.
Message 5 of 6
(3,231 Views)

Alright I figured it out this way! Thanks alot for the help!

File added to how I did it.

0 Kudos
Message 6 of 6
(3,217 Views)