Writing titles and x/y labels inside a for loop and if-statements
2 ビュー (過去 30 日間)
古いコメントを表示
I am ploting four different subplots and i am trying to title and label each axis of each subplot. The only one that gets titled and labled is the very last subplot. How might i fix this issue? See code and pictures.

F0 = 32100:125:32475;
for i = 1:1:4
FS = 8000;
f0=F0(i)/FS;
x = sin(2*pi*f0.*n + phi);
stem(n, x)
if (i == 1)
subplot(2,2,i)
stem(n, x)
title('Hz');
ylabel('[x(n)]');
xlabel('n');
elseif (i == 2)
subplot(2,2,i)
stem(n, x)
title('225Hz');
ylabel('[x(n)]');
xlabel('n');
elseif (i == 3)
subplot(2,2,i)
stem(n, x)
title('350Hz');
ylabel('[x(n)]');
xlabel('n');
elseif (i == 4)
subplot(2,2,i)
stem(n, x)
title('475Hz');
ylabel('[x(n)]');
xlabel('n');
end
end
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!