필터 지우기
필터 지우기

Want to create a time vector

조회 수: 1 (최근 30일)
Kyo Doe
Kyo Doe 2022년 10월 2일
답변: Star Strider 2022년 10월 2일
Hello guys,
i got stuck in this one. I want to create a time vector like -10 <= t < 10 ( because using <= then i have to include -10 in t and not include 10 in t.)
i did something like:
t = -10:0.01:10;
stp = @(t) double(t>=0);
Is my code right?

답변 (1개)

Star Strider
Star Strider 2022년 10월 2일
I have no idea what you want to do, although the linspace function may be a more precise approach —
t = -10:0.01:10-0.01 % 'colon'
t = 1×2000
-10.0000 -9.9900 -9.9800 -9.9700 -9.9600 -9.9500 -9.9400 -9.9300 -9.9200 -9.9100 -9.9000 -9.8900 -9.8800 -9.8700 -9.8600 -9.8500 -9.8400 -9.8300 -9.8200 -9.8100 -9.8000 -9.7900 -9.7800 -9.7700 -9.7600 -9.7500 -9.7400 -9.7300 -9.7200 -9.7100
t(end)
ans = 9.9900
t = linspace(-10, 9.99, 2000) % 'linspace'
t = 1×2000
-10.0000 -9.9900 -9.9800 -9.9700 -9.9600 -9.9500 -9.9400 -9.9300 -9.9200 -9.9100 -9.9000 -9.8900 -9.8800 -9.8700 -9.8600 -9.8500 -9.8400 -9.8300 -9.8200 -9.8100 -9.8000 -9.7900 -9.7800 -9.7700 -9.7600 -9.7500 -9.7400 -9.7300 -9.7200 -9.7100
t(end)
ans = 9.9900
.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by