필터 지우기
필터 지우기

Difference between x = 0:0.1:2*pi and linspace(0,2*pi,0.1)

조회 수: 13 (최근 30일)
Dhairya
Dhairya 2022년 11월 13일
댓글: Dhairya 2022년 11월 13일
i was going through a matlab code and it had x = 0:0.1:2*pi written
i wanted to ask what is the difference between this and linspace and how it is used?

채택된 답변

David Hill
David Hill 2022년 11월 13일
Linspace divides the interval into the exact number specified, while colon notation just keeps increasing the interval by the middle number not to exceed the last number.
x=0:.1:2*pi
x = 1×63
0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.0000 2.1000 2.2000 2.3000 2.4000 2.5000 2.6000 2.7000 2.8000 2.9000
y=linspace(0,2*pi,63)
y = 1×63
0 0.1013 0.2027 0.3040 0.4054 0.5067 0.6081 0.7094 0.8107 0.9121 1.0134 1.1148 1.2161 1.3174 1.4188 1.5201 1.6215 1.7228 1.8242 1.9255 2.0268 2.1282 2.2295 2.3309 2.4322 2.5335 2.6349 2.7362 2.8376 2.9389
See the difference.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by