Multi Plot with 8 (eight) plots in figure

Hello,
I have 8 plots and would like for them to show up like this in my figure:
here is my MWE with just 4 plots:
% Frequency vector
x = 10:1000;
% Phase noise vector
y = 10:1000;
% Graph settings
subplot(2, 2, 1);
semilogx(x,y); grid on;
title('Pass1 Response');
xlabel('Frequency (Hz)'); ylabel('Amplitude');
subplot(2, 2, 2);
semilogx(x,y); grid on;
title('Data after Pass1');
xlabel('Frequency (Hz)'); ylabel('Amplitude');
subplot(2, 2, 3);
semilogx(x,y); grid on;
title('Pass 2 Response');
xlabel('Frequency (Hz)'); ylabel('Amplitude');
subplot(2,2,4);
semilogx(x,y); grid on;
title('Data after Pass 2');
xlabel('Offset Frequency (Hz)'); ylabel('Amplitude');
Any help will be greatly appreciated.
Thanks.

 採用された回答

Jon
Jon 2015 年 9 月 16 日
編集済み: Jon 2015 年 9 月 16 日

1 投票

You need to divide the plotting space into 5 rows with 2 columns, so your first plot, for example, would read
subplot(5,2,[1 2])
your third would be
subplot(5,2,3)
and your last would be
subplot(5,2,[9 10])
Is that what you were asking?

3 件のコメント

monkey_matlab
monkey_matlab 2015 年 9 月 16 日
I tried following your procedure:
subplot(5,2,1)
subplot(5,2,[2 3])
subplot(5,2,[4 5])
subplot(5,2,[6 7])
subplot(5,2,8)
but only ended up with 1 plot. Can you tell me what I am doing wrong?
Jon
Jon 2015 年 9 月 17 日
To be clear, using the code you originally posted, you would write
% Plot original data
subplot(5,2,[1 2])
semilogx(x,y); grid on;
title('Original Data');
xlabel('Frequency (Hz)'); ylabel('Amplitude');
% Plot Data After Pass 1
subplot(5,2,4)
semilogx(x,y); grid on;
title('Data after Pass1');
xlabel('Frequency (Hz)'); ylabel('Amplitude');
And so on. After each call to subplot, you need to actually plot something before calling a different subplot.
monkey_matlab
monkey_matlab 2015 年 9 月 17 日
THANK YOU!

サインインしてコメントする。

その他の回答 (1 件)

Varun Chowdary
Varun Chowdary 2021 年 9 月 22 日

0 投票

subplot(5,2,[9 10])

製品

タグ

質問済み:

2015 年 9 月 16 日

回答済み:

2021 年 9 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by