07-29-2014 05:15 PM
I need to plot several curves on an xy graph.
I know how to plot multiple curves I just don't know how to do it with an equation.
example y=2.039+1.116*exp(.01468*x)
I did this with point to point manually, but will have many of these with plus and minus also.
So plotting with an equation would save alot of time.
Solved! Go to Solution.
07-29-2014 05:47 PM - edited 07-29-2014 05:50 PM
Hey,
I'm not sure if I get your problem correctly, but you can do all kind of maths with arrays as well (even for example multiple an array with a single number or another array) and you can bundle them to be plotted on xy graphs.
For example in this snippet (you can copy this image to the block diagram and use the code from it) I use the for loop to give an array to be the x axis (you can use your existing x axis data in an array) and then I do several mathematics on it: first I do your formula to calculate y data, secondly I do a truncated version of your formula to get another set of y data and lastly I use a mathscript node to get the same data as the first one (although with slower performance, especially if you use many formulas as primitives give much better performance than mathscript). Then I bundle them into clusters and build an array of them to plot all of them
Then the result is this with plot 0 hiding plot 2 as both have the same data.
I hope you were looking for some help like this.
07-29-2014 05:49 PM - edited 07-29-2014 05:50 PM
Create an x-ramp and then apply the formula to calculate the y-values. Bundle the two for a plot. If all plots share the same x-values, you only need to create the ramp once.
07-30-2014 09:27 AM - edited 07-30-2014 09:28 AM
jeanlucpicard This worked perfectly thanks.
The bundling of the data and using the for loop is exactly what I was looking for.
07-30-2014 09:43 AM
I'm glad I could help. However, if you need an x-axis with a sub-1 resolution (i.e. with decimal values) you might want to use the ramp as altenbach suggested instead of the for loop
07-30-2014 10:36 AM
Currently i don't need sub one yet, but it will come.
Is the x-ramp just math inside of the for loop or is it a function?
07-30-2014 10:48 AM
There is "ramp pattern" in the signal processing...signal generation palette. Just give it start, end, and number of points.
07-30-2014 10:55 AM
Thanks. This also helped me to find another vi I have been looking for!