Hi Everyone,
Having struggles with using subplot function. I tried learning from the very basics and tried out this simple code I found on internet
x = 0:5;
y = sin(x);
z = log(y);
subplot(2,2,1);
plot(x,y);
subplot(2,2,3);
plot(y,z);
subplot(2,2,4);
plot(x,z);
but this is giving me a index exceeds matrix dimensions error. What could be wrong?

Antworten (1)

Walter Roberson
Walter Roberson am 12 Jul. 2017

1 Stimme

That code has problems with plotting imaginary values, but no problem with index exceeding matrix dimensions.
However, it is possible that you have previously made an assignment to a variable named "sin" or "log" or "subplot" or "plot"

Gefragt:

am 12 Jul. 2017

Beantwortet:

am 12 Jul. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by