Plotting different functions at the end of eachother
2 views (last 30 days)
Show older comments
I have 2 functions one for 0<x<10 and one for 10<x<30. How do i plot the second one at the point where the first one ends?
1 Comment
Accepted Answer
Sean de Wolski
on 1 Feb 2012
fz10 = @(x)x+3;%two functions
f1030 = @(x)(x+3)*2;
t = 0:20;
plot(t(t<10),fz10(t(t<10)),'r*',t(t>10&t<30),f1030(t(t>10&t<30)),'b*') %logical indexing!
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!