LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bivariate gauss

hi all, my first problem is that i'm trying to generate and plot a bivariate normal gauss function on a 3d plot, i spent much time on this vi and i can't get it to work fine

my second problem is that i want to plot 2 3D normal Gaussians on the same plot, and i don't understand 3D plots very well

any help will be appreciated

0 Kudos
Message 1 of 9
(4,148 Views)

The array manipulations at the beginning of your code "look wrong", and are certainly written in a much more complicated manner than necessary.  For example, you use the construct

Array Question.png

and, in some cases, reverse this array (all of whose elements are identical).  With the new possibilities for output tunnels introduced (I think) in LabVIEW 2012, there is often no need for building arrays by appending elements to an empty array.

 

Bob Schor

0 Kudos
Message 2 of 9
(4,123 Views)

thanks, i agree with you, but can you help make it work... the result plot is not what i expect


@Bob_Schor wrote:

The array manipulations at the beginning of your code "look wrong", and are certainly written in a much more complicated manner than necessary.  For example, you use the construct

Array Question.png

and, in some cases, reverse this array (all of whose elements are identical).  With the new possibilities for output tunnels introduced (I think) in LabVIEW 2012, there is often no need for building arrays by appending elements to an empty array.

 

Bob Schor


 

0 Kudos
Message 3 of 9
(4,110 Views)

this is what i expectpic1.png

but instead i get thispic2.png

0 Kudos
Message 4 of 9
(4,099 Views)

Maybe you need to interpolate the points? Please look at this shipping example to see how you can do that:

 

C:\Program Files (x86)\National Instruments\LabVIEW 2014\examples\Mathematics\Interpolation\Scattered 2D Interpolation.vi

 

Fit a element.PNG

fit an elem.PNG

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 5 of 9
(4,091 Views)

i tried all the examples 🙂 .. didn't help much

0 Kudos
Message 6 of 9
(4,085 Views)

Did you look carefully at Barp's example?  Do you see that there are two plots, neither of which is the plot you used?  Have you tried doing what Barp did?

 

BS

0 Kudos
Message 7 of 9
(4,074 Views)

As a fist step, search the forum (e.g. this thread)

 

But before you go any further, learn some LabVIEW basics. It will make everything much easier. Here are some glaring mistakes:

 

  1. Why are your two array controls inside a loop? Do you expect them to change while the loop is executing? Why do you read them also outside the loop via a value property node? Solution: the two control terminals belong on the toplevel diagram (not inside any loop) and the property nodes can be eliminated by just branching the wire (If you got confused by the autoindexing, make sure to disable indexing when wiring to inside the loop).
  2. Index array wired to [i] is equivalent to autoindexing. Now you don't even need to wire N.
  3. Your covariance only has a single row, so there is no element at (1,1). Dont' try to read that position. Why ins't this a 1D array?
  4. Your "mean" only has one element. Why isn't it a scalar?
  5. None of your shift registers are needed! Learn about autoindexing at output tunnels!
  6. Several of your FOR loops could be combined into one.
  7. I am not even trying to dissect the rest of your code, but it seems very convoluted.
  8. properly coded, you would only need about 25% of the current code to do the same thing. Way too much unecessary stuff!
  9. etc.

 

 

0 Kudos
Message 8 of 9
(4,063 Views)

I think also part of the problem you are running into is because your are not configuring your graph properly.

 

The example shows how you can generate a 'cloud' of points' (not connected to each other) that will show how you can evaluate the bivariate gauss function and plot it. The second graph shows how you can fit a function into points and that would generate probably the graph above.

 

But, the important part is learning how to setup the graphs to show this way and how you code in LV for that. Altenbach gave you several tips in how to do this too...

 

Hopefully the example can be useful now...

 

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 9 of 9
(3,986 Views)