uneven number of subplots in columns

31 views (last 30 days)
Hi,
I'm not sure if the title of this question makes any sense so I'm going to try and explain it here. Let's say that I have three equations, A = 2x, B = x^2, and C = B - A. I want to create a subplot that shows all three functions plotted however, I don't want 1 column and 3 rows or 1 row and 3 columns. I want to do a 2 column subplot with A and B on separate rows in the first column and the second column contains equation C. The only way that I can see to do it is to do a 2 x 2 subplot but this isn't what I want. I want equation C to encompass all of the second column. I'm open to suggestions on how to do this and I hope this makes sense.

Accepted Answer

Star Strider
Star Strider on 10 Dec 2017
Try this:
x = rand(1, 10);
A = 2*x;
B = x.^2;
C = B - A;
figure(1)
subplot(2,2,1)
plot(A)
title('A')
subplot(2,2,3)
plot(B)
title('B')
subplot(2,2,[2 4])
plot(C)
title('C')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!