Subplots in Matlab 2017
Show older comments
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?
Answers (1)
Walter Roberson
on 12 Jul 2017
1 vote
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"
Categories
Find more on Subplots 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!