discrete-time rectangular functions

์กฐํšŒ ์ˆ˜: 11 (์ตœ๊ทผ 30์ผ)
Maria De Medeiros Oliveira
Maria De Medeiros Oliveira 2022๋…„ 2์›” 7์ผ
๋‹ต๋ณ€: Voss 2022๋…„ 2์›” 7์ผ
I need help defining a discrete-time rectangular function
rect[n] = {1, 0โ‰ค๐‘›โ‰ค๐‘
0, ๐‘’๐‘™๐‘ ๐‘’ }
This is what I have:
rect_n1 = ones(1,T);
for n=0:(N_1)
rect_n1(n)=1;
end

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

Voss
Voss 2022๋…„ 2์›” 7์ผ
You should initialize rect_n1 to zeros if you're going to set the places where it's 1, and indexing in MATLAB starts with 1, so:
T = 10;
N_1 = 5;
rect_n1 = zeros(1,T);
for n=1:(N_1)
rect_n1(n)=1;
end
plot(rect_n1)
or, without the loop:
T = 10;
N_1 = 5;
rect_n1 = zeros(1,T);
rect_n1(1:N_1) = 1;
plot(rect_n1)

์นดํ…Œ๊ณ ๋ฆฌ

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

ํƒœ๊ทธ

Community Treasure Hunt

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

Start Hunting!

Translated by