logspace with gap of half

조회 수: 3 (최근 30일)
Megha
Megha 2019년 1월 6일
댓글: Megha 2019년 1월 6일
yt = logspace(-3,4,8);
This gives 0.001, 0.01, 0.1,1,10,100,1000,10000
However, I want
0.001, 0.005, 0.01,0.05, 0.1, 0.5, 1,5, 10,50, 100,500, 1000,5000, 10000
How Can i get that?
Can anyone help?

채택된 답변

Stephen23
Stephen23 2019년 1월 6일
편집: Stephen23 2019년 1월 6일
>> V = logspace(-3,4,8);
>> V = [V;5*V];
>> V = V(1:end-1)
V =
0.001 0.005 0.010 0.050 0.100 0.500 1.000 5.000 10.000 50.000 100.000 500.000 1000.000 5000.000 10000.000
Note that the values you requested are not evenly spaced in log-space (because the power difference between adjacent values alternates between ~0.30103 and ~0.69897). Evenly spaced values would simply be:
>> V = logspace(-3,4,15)
0.0010000 0.0031623 0.0100000 0.0316228 0.1000000 0.3162278 1.0000000 3.1622777 10.0000000 31.6227766 100.0000000 316.2277660 1000.0000000 3162.2776602 10000.0000000
where the difference in powers between adjacent values is always exactly 0.5.
  댓글 수: 1
Megha
Megha 2019년 1월 6일
Yes, It woked!
Thnak you so much @Stephen Cobeldick

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by