How to create a vector dVec = [5^0 5^0.01 ⋯ 5^0.99 5^1].
조회 수: 4 (최근 30일)
이전 댓글 표시
I need to create a vector dVec = [5^0 5^0.01 ⋯ 5^0.99 5^1] (logarithmically spaced numbers between 1 and 10, use logspace), but I'm not sure I'm doing this correctly. So far, I've created this:
dVec = logspace(0, 1, 100)
How do I make sure it's 5's to the power of instead of 10's?
Thank you.
댓글 수: 0
답변 (3개)
Star Strider
2016년 7월 20일
The bsxfun function is your friend for these types of problems:
expvec = logspace(0, 1, 100);
dVec = bsxfun(@power, 5*ones(size(expvec)), expvec);
댓글 수: 0
Azzi Abdelmalek
2016년 7월 20일
편집: Azzi Abdelmalek
2016년 7월 20일
ldVec = logspace(0, log10(5), 100)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!