Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: two lslines on one plot
Replies: 1   Last Post: Jul 16, 2008 3:29 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Daniel Walker

Posts: 33
Registered: 7/27/07
Re: two lslines on one plot
Posted: Jul 16, 2008 3:29 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

TRY THIS:
x=1:50;
y1 = 1.5*x + 5 + randn(size(x));
y2 = -1.1*x +100 + randn(size(x));

[AX, H1, H2]=plotyy(x, y1, x, y2);

set(H1,'Marker','.','linestyle','none');
set(H2,'Marker','o','linestyle','none');

axes(AX(1)); hold on; line( x, polyval(polyfit(x,y1,1),x));
axes(AX(2)); hold on; line( x, polyval(polyfit(x,y2,1),x));






"Young Ryu" <ryuyr77@gmail.com> wrote in message <g5leur$504
$1@fred.mathworks.com>...
> Hi-
>
> I have two data: both data have same x-axis data but
> different y-values. I'd like to use double y-axis
> (plotyy), AND draw lslines for each data.
>
> [AX, H1, H2]=plotyy(x, y1, x, y2);
>
> Here, can you help how to draw each lsline (least squared
> fit line) for each data(i.e. x vs y1 PLUS x vs y2) one

the
> plotyy figure?
>
> Thanks
>
>





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.