Consider a signal ๐‘ฅ[๐‘›] = (0.2)๐‘›๐‘ข[๐‘›]. plot the magnitude, angle, real and imaginary parts of ๐‘‹(๐‘’๐‘—๐œ”). Plot ๐‘‹(๐‘’๐‘—๐œ”) at 101 101 equispaced points between 0 and ๐œ‹. help me to find error in subplot command. all four items are not plotted.

์กฐํšŒ ์ˆ˜: 9 (์ตœ๊ทผ 30์ผ)
Umar Bhai
Umar Bhai 2019๋…„ 5์›” 28์ผ
๋‹ต๋ณ€: Alex Mcaulley 2019๋…„ 5์›” 28์ผ
w = [0:1:100]*pi/100;
X = exp(j*w) ./ (exp(j*w) - 0.2*ones(1,101));magX = abs (X) ; angX = angle (X) ;realX = real(X); imagX = imag(X);subplot(2,2,1); plot(w/pi,magX);
xlabel('frequency in pi units'); title('Magnitude Part');ylabel('Magnitude')subplot(2,2,2); plot(w/pi,angX); xlabel('frequency in pi units');title('AnglePart');ylabel('Radians')subplot(2,2,3);plot(w/pi,realX);
xlabel('frequency in pi units'); title('Real Part');ylabel('Real')
subplot(2,2,4); plot(w/pi,imagX); xlabel('frequency in pi units'); title('Imaginary Part'); ylabel('Imaginary')
Capture.PNG

๋‹ต๋ณ€ (1๊ฐœ)

Alex Mcaulley
Alex Mcaulley 2019๋…„ 5์›” 28์ผ
Your problem is due to bad programming practices. I recommend to put each instruction in a separate line. If you do that your script works. If you don't do that you have to put a semicolon after each instruction.
w = [0:1:100]*pi/100;
X = exp(j*w) ./ (exp(j*w) - 0.2*ones(1,101));
magX = abs (X);
angX = angle (X);
realX = real(X);
imagX = imag(X);
subplot(2,2,1);
plot(w/pi,magX);
xlabel('frequency in pi units');
title('Magnitude Part');
ylabel('Magnitude')
subplot(2,2,2);
plot(w/pi,angX);
xlabel('frequency in pi units');
title('AnglePart');
ylabel('Radians')
subplot(2,2,3);
plot(w/pi,realX);
xlabel('frequency in pi units');
title('Real Part');
ylabel('Real')
subplot(2,2,4);
plot(w/pi,imagX);
xlabel('frequency in pi units');
title('Imaginary Part');
ylabel('Imaginary')

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Subplots์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์•„์ง ํƒœ๊ทธ๋ฅผ ์ž…๋ ฅํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

Community Treasure Hunt

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

Start Hunting!

Translated by