user3271929
user3271929

Reputation: 327

Can I give two ranges of number for a plot

How I can give two ranges of x for a plot, for a simple example considering x=0:0.5:50; and x=50:10:1000;

y=x.^2
plot(x,y)

Upvotes: 1

Views: 52

Answers (2)

FxH
FxH

Reputation: 44

If I understand your problem right, this might be a solution:

x = [0:0.5:50, 50:10:1000];
y = x.^2;
plot(x,y);

Upvotes: 1

LJSilver
LJSilver

Reputation: 603

I didn't get the question. Please explain exactly what you need.

If your aim is to concatenate two plots you can simply compute y in the two interval separately.

x=0:0.5:50;
y=x.^2;
plot(x,y);
hold on
x=50:10:1000;
y=x.^2;
plot(x,y)

Upvotes: 0

Related Questions