logarithmically spaced vector in a certain range
이전 댓글 표시
How to create a logarithmically spaced vector say from values 3 to 10? Thank you!
채택된 답변
추가 답변 (2개)
Nathan Porter
2017년 4월 7일
Like Marco, I would suggest using logspace. For example,
logspace(1,3,10)
creates a vector of 10 logarithmically spaced values between 10^1 and 10^3. If you instead want the bounds to be determined by a value and not the exponent, I generally use the following:
logspace(log10(3),log10(10),10)
This will create a vector of 10 logarithmically spaced values between 3 and 10.
댓글 수: 1
Johann Martinez
2021년 3월 15일
Thank Nathan, but what if I have a, b values equals to 0, 0.97, for example?
I mean, the logspaced vector is full of NaN, because of the negative logarithm...
thanks in advance
Marco
2014년 10월 3일
1 개 추천
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!