What is the difference between a vector and using linspace?
조회 수: 19 (최근 30일)
이전 댓글 표시
I know that sometimes the formula var_name = linspace (xi,xf,n) is used and sometimes var_name = [m:q:n] when do you differentiate between using either?
댓글 수: 0
답변 (1개)
Star Strider
2015년 8월 31일
The linspace function produces a vector of fixed length (defined by the third argument) between the limits defined by the first two. The function determines the step size.
The colon operator defines a vector from the start, step, and end values, and as the result the length is determined by those values.
I generally use linspace when I want to determine the length, and usually use the colon operator when I want integer values in the vector. Personal preference, others likely have different views.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!