<< Chapter < Page Chapter >> Page >
Introduces graphical representation of data in LabVIEW MathScript.

Graphical representation of data in labview mathscript

LABVIEW MATHSCRIPT provides a great variety of functions and techniques for graphical display of data. The flexibility andease of use of LABVIEW MATHSCRIPT's plotting tools is one of its key strengths. In LABVIEW MATHSCRIPT graphs are shown in a figure window. Several figurewindows can be displayed simultaneously, but only one is active. All graphing commands are applied to the active figure. The command figure(n) will activate figure number n or create a new figure indexed by n .

Tools for plotting

In this section we present some of the most commonly used functions for plotting in LABVIEW MATHSCRIPT.

  • plot - The plot and stem functions can take a large number of arguments, see help plot and help stem. For example theline type and color can easily be changed. plot(y) plots the values in vector y versus their index. plot(x,y) plots the values in vector y versus x . The plot function produces a piecewise linear graph between its data values. With enough data points it lookscontinuous.
  • stem - Using stem(y) the data sequence y is plotted as stems from the x-axis terminated with circles for the data values. stem is the natural way of plotting sequences. stem(x,y) plots the data sequence y at the values specified in x .
  • xlabel('string') - Labels the x-axis with string .
  • ylabel('string') - Labels the y-axis with string .
  • title('string') - Gives the plot the title string .

To illustrate this consider the following example.

In this example we plot the function y = x2 for x 2 [-2; 2].

x = -2:0.2:2;

y = x.^2;

figure(1);

plot(x,y);

xlabel('x');

ylabel('y=x^2');

title('Simple plot');

figure(2);

stem(x,y);

xlabel('x');

ylabel('y=x^2');

title('Simple stem plot');

This code produces the following two figures.

Some more commands that can be helpful when working with plots:

  • hold on / off - Normally hold is off. This means that the plot command replaces the current plot with the new one. To add anew plot to an existing graph use hold on . If you want to overwrite the current plot again, use hold off .
  • legend('plot1','plot2',...,'plot N') - The legend command provides an easy way to identify individual plots when there are more than one per figure. A legendbox will be added with strings matched to the plots.
  • axis([xmin xmax ymin ymax]) - Use the axis command to set the axis as you wish. Use axis on/off to toggle the axis on and off respectively.
  • subplot(m,n,p) -Divides the figure window into m rows, n columns and selects the p p'th subplot as the current plot, e.g subplot(2,1,1) divides the figure in two and selects the upper part. subplot(2,1,2) selects the lower part.
  • grid on/off - This command adds or removes a rectangular grid to your plot.

This example illustrates hold , legend and axis .

x = -3:0.1:3; y1 = -x.^2; y2 = x.^2;

figure(1);

plot(x,y1);

hold on;

plot(x,y2,'--');

hold off;

xlabel('x');

ylabel('y_1=-x^2 and y_2=x^2');

legend('y_1=-x^2','y_2=x^2');

figure(2);

plot(x,y1);

hold on;

plot(x,y2,'--');

hold off;

xlabel('x');

ylabel('y_1=-x^2 and y_2=x^2');

legend('y_1=-x^2','y_2=x^2');

axis([-1 1 -10 10]);

The result is shown below.

In this example we illustrate subplot and grid.

x = -3:0.2:3; y1 = -x.^2; y2 = x.^2;

subplot(2,1,1);

plot(x,y1);

xlabel('x'); ylabel('y_1=-x^2');

grid on;

subplot(2,1,2);

plot(x,y2);

xlabel('x');

ylabel('y_2=x^2');

Now, the result is shown below.

Printing and exporting graphics

After you have created your figures you may want to print them or export them to graphic files. In the "File"menu use "Print" to print the figure or "Save As" to save your figure to one of the many available graphics formats. Using theseoptions should be sufficient in most cases, but there are also a large number of adjustments available by using "Export setup","Page Setup" and "Print Setup".

3d graphics

We end this module on graphics with a sneak peek into 3D plots. The new functions here are meshgrid and mesh . In the example below we see that meshgrid produces x and y vectors suitable for 3D plotting and that mesh(x,y,z) plots z as a function of both x and y .

Example: Creating our first 3D plot.

[x,y] = meshgrid(-3:.1:3);

z = x.^2+y.^2;

mesh(x,y,z);

xlabel('x');

ylabel('y');

zlabel('z=x^2+y^2');

This code gives us the following 3D plot.

Questions & Answers

find the 15th term of the geometric sequince whose first is 18 and last term of 387
Jerwin Reply
The given of f(x=x-2. then what is the value of this f(3) 5f(x+1)
virgelyn Reply
hmm well what is the answer
Abhi
how do they get the third part x = (32)5/4
kinnecy Reply
can someone help me with some logarithmic and exponential equations.
Jeffrey Reply
sure. what is your question?
ninjadapaul
20/(×-6^2)
Salomon
okay, so you have 6 raised to the power of 2. what is that part of your answer
ninjadapaul
I don't understand what the A with approx sign and the boxed x mean
ninjadapaul
it think it's written 20/(X-6)^2 so it's 20 divided by X-6 squared
Salomon
I'm not sure why it wrote it the other way
Salomon
I got X =-6
Salomon
ok. so take the square root of both sides, now you have plus or minus the square root of 20= x-6
ninjadapaul
oops. ignore that.
ninjadapaul
so you not have an equal sign anywhere in the original equation?
ninjadapaul
hmm
Abhi
is it a question of log
Abhi
🤔.
Abhi
Commplementary angles
Idrissa Reply
hello
Sherica
im all ears I need to learn
Sherica
right! what he said ⤴⤴⤴
Tamia
hii
Uday
what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
Kevin Reply
a perfect square v²+2v+_
Dearan Reply
kkk nice
Abdirahman Reply
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
Kim Reply
or infinite solutions?
Kim
The answer is neither. The function, 2 = 0 cannot exist. Hence, the function is undefined.
Al
y=10×
Embra Reply
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
Nancy Reply
rolling four fair dice and getting an even number an all four dice
ramon Reply
Kristine 2*2*2=8
Bridget Reply
Differences Between Laspeyres and Paasche Indices
Emedobi Reply
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
Mary Reply
how do you translate this in Algebraic Expressions
linda Reply
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
Crystal Reply
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Chris Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
Hello
Uday
I'm interested in Nanotube
Uday
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
Prasenjit
can nanotechnology change the direction of the face of the world
Prasenjit Reply
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
Ali Reply
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
bamidele Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Introduction to labview mathscript. OpenStax CNX. Aug 06, 2006 Download for free at http://cnx.org/content/col10370/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Introduction to labview mathscript' conversation and receive update notifications?

Ask