Plotting different functions at the end of eachother

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?

 Réponse acceptée

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!

Plus de réponses (0)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by