Matlab subplot画图。
조회 수: 15 (최근 30일)
이전 댓글 표시
版本: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.。
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!