ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript plot, how do I specify 2nd Y axis maximum and minmum?

x = 0:0.01:20;

y1 = 200*exp(-0.05*x).*sin(x);

y2 = 0.8*exp(-0.5*x).*sin(10*x);

plotyy(x,y1,x,y2);

axis([0,20,-200,200])

 

above script plot successfully a graph with require left y axis from -200 to +200.  However, how do I make the right y axis from -2 to +2?

 

Thank you in advance.

0 Kudos
Message 1 of 8
(3,703 Views)

x = 0:0.01:20;

y1 = 200*exp(-0.05*x).*sin(x);

y2 = 0.8*exp(-0.5*x).*sin(10*x);

plotyy(x,y1,x,y2);

axis([0,20,-200,200]);

xlabel('Time (\musec)');

ylabel('Fast decay');

title('Multiple Decay Rates');

 

How do I write the 2nd Y title to 'Slow Decay'?

0 Kudos
Message 2 of 8
(3,696 Views)

Hi Qing,

 

You questions seems to be more Matlab related than LabVIEW related. Have you had a look at the Matlab community page?

0 Kudos
Message 3 of 8
(3,671 Views)

This webpage may be able to help you: http://zone.ni.com/devzone/cda/tut/p/id/7006

0 Kudos
Message 4 of 8
(3,668 Views)

Yes I did.  Matlab has small differences with Mathscript.  I copyed over some examples from Matlab website.  They did not work in LabVIEW Mathscrpt.

0 Kudos
Message 5 of 8
(3,667 Views)

As far as I can tell, MathScript does not have the necessary functions to do what you are asking. In newer versions of LabVIEW there is the "axes" function, but I don't know if that will do what you want.

0 Kudos
Message 6 of 8
(3,656 Views)

Thank you for replying to me.  Mathscript let me plot a 2nd Y on the right but not let me to put a label for it.  Do you think this is a fault of LabVIEW in design?  What is the point to put a "plotyy" function there but not being able to scale it or label it?  Does National Instruments has a channel to complain?

0 Kudos
Message 7 of 8
(3,653 Views)

I agree that this is a limitation in MathScript. I would also agree that it makes no sense to have a plotyy function, but no function to label the second Y-Axis plot.

 

Did you take a look at the "axes" function to see if that will work? Unfortunately, I can't test it since I don't have a MathScript license for the newer versions of LabVIEW.

0 Kudos
Message 8 of 8
(3,650 Views)