Hello Everyone,
I have a very itchy problem.
I am trying to plot the following function which has jump discontinuities.
x=0:0.0001:2;
y=5*x;
x1=2:0.0001:3;
y1=5*(x1)+1;
plot(x,y,x1,y1);
This is giving a plot which has a jump discontinuity at 2. I want the matlab to join discontinuity by a line.
Thanks in advance.
Thanks & Regards,
Arun Sahu

 Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 28 Apr. 2012

0 Stimmen

f = @(x)5*x + (x > 2)
plot(0:1e-4:3,f(0:1e-4:3))
OR:
x=0:0.0001:2;
y=5*x;
x1=2:0.0001:3;
y1=5*(x1)+1;
plot([x,x1],[y,y1]);

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by