필터 지우기
필터 지우기

nested for loop

조회 수: 1 (최근 30일)
Baba
Baba 2011년 11월 3일
This code gives me 6 subplots like I need, howerver, what I'd like to do is for each subplot i'd like the X to switch trhough 5 other letters.
for i=1:6;
Zu = 1;
subplot(3,2,i)
Str = sprintf('X%d',Zu );
Hs=spectrum.periodogram;
psdest = psd(Hs,eval(Str),'Fs',Fs);
semilogx(psdest.Frequencies,10*log10(psdest.Data));
grid on;
xlabel('Frequency (Hz)')
ylabel('dB/Hz')
title(Str);
end

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 11월 3일
Letter={'X','Y','Z','K','V'};
for i=1:6
for k=1:length(Letter)
str=sprintf('%s%d',Letter{k},i);
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by