discrete-time (D-T) real exponentials subplot

조회 수: 6 (최근 30일)
Peyton Punch
Peyton Punch 2020년 1월 21일
답변: Sindar 2020년 1월 21일
I am having trouble understanding what to do for this problem. I have never used matlab before. Any guidance in a direction would be great. I attached the code that I tried
for n = 1:1:4
z = [-2,-.5,.5,2];
x = z.^n;
subplot(2,2,n)
stem(z,x)
end

채택된 답변

Sindar
Sindar 2020년 1월 21일
You're mixing the plot number up with the element of the series, try:
% set the discrete values for plotting (n in x[n])
n = 0:10;
% set the collection of z's for plots
z = [-2,-.5,.5,2];
% iterate over the subplots
for plot_n = 1:4
% calculate x[n] for current z
x = z(plot_n).^n;
subplot(2,2,plot_n)
% plot x[n] vs n
stem(n,x)
% title it with current z
title(z(plot_n))
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by