Matlab subplot画图。

18 vues (au cours des 30 derniers jours)
mjjkcdr
mjjkcdr le 22 Mai 2023
版本: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.。

Réponse acceptée

tqqxaxrw
tqqxaxrw le 22 Mai 2023
仅供参考,试试
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.')

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!