Matlab subplot画图。

14 ビュー (過去 30 日間)
mjjkcdr
mjjkcdr 2023 年 5 月 22 日
回答済み: tqqxaxrw 2023 年 5 月 22 日
版本:Matlab R2017_b
代码核心部分如下:
mx = min(x);
Mx = max(x);
s = size(imf);
k = s(1);
M = max(max(abs(imf(1:k-1,:))));
subplot(k+1,1,1)
plot(t,x)
axis([t(1) t(s(2)) mx Mx])
set(gca,'YTick',[])
set(gca,'XTick',[])
ylabel(['signal'])
for j = 1:k-1
subplot(k+1,1,j+1)
plot(t,imf(j,:))
axis([t(1) t(s(2)) -M M])
set(gca,'YTick',[])
set(gca,'XTick',[])
ylabel(['imf',int2str(j)])
end
subplot(k+1,1,1)
title('Empirical Mode Decomposition')
mr = min(imf(k,:));
Mr = max(imf(k,:));
subplot(k+1,1,k+1)
plot(t,imf(k,:),'r')
axis([t(1) t(s(2)) mr Mr])
set(gca,'YTick',[])
set(gca,'XTick',[])
ylabel('res.')
以上代码画出来的是图一。
请问怎么修改参数画出类似图二的效果。要求是Signal在第1行,下面5行2列画出imf 1~9和res.。

採用された回答

tqqxaxrw
tqqxaxrw 2023 年 5 月 22 日
仅供参考,试试
mx = min(x);
Mx = max(x);
s = size(imf);
k = s(1);
M = max(max(abs(imf(1:k-1,:))));
subplot(k/2+1,2,[1,2])
plot(t,x)
axis([t(1) t(s(2)) mx Mx])
set(gca,'YTick',[])
set(gca,'XTick',[])
ylabel(['signal'])
for j = 1:k-1
        subplot(k/2+1,2,j+2)
        plot(t,imf(j,:))
        axis([t(1) t(s(2)) -M M])
        set(gca,'YTick',[])
        set(gca,'XTick',[])
        ylabel(['imf',int2str(j)])
end
subplot(k+1,1,1)
title('Empirical Mode Decomposition')
mr = min(imf(k,:));
Mr = max(imf(k,:));
subplot(k+1,1,k+1)
plot(t,imf(k,:),'r')
axis([t(1) t(s(2)) mr Mr])
set(gca,'YTick',[])
set(gca,'XTick',[])
ylabel('res.')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!