The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Single Trendline for multiple datasets
Replies: 3   Last Post: Jan 24, 2013 3:03 PM

Advanced Search

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

Posts: 9,850
Registered: 6/7/07
Re: Single Trendline for multiple datasets
Posted: Jan 24, 2013 10:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/23/2013 4:58 PM, Charlotte wrote:

> ... - of course 'dpb' makes a good point as
> after this code, I lose the different colours of the different datasets,
> but his lsline suggestion didn't work -...

Of course it works... :)

Well, you have to do a few extra steps...try the following to see...

>> y=rand(5); % some random data
>> h=plot(y(:),'*'); % plot the whole shmear to
>> lsline % put on the trend line
>> set(h,'ydata',[]) % leave only the line
>> hold on % don't wipe it out w/
>> plot(y) % the data coming...
>> xlim([1 5]) % set the axis limits

Of course, by now you could have just done the coefficients... :)

I wasn't thinking the trendline would also be in background color when
the plot color was turned to background. Also note that lsline doesn't
work on line plots--you have to use a marker or the internal logic will
not find the data handles.


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.