採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 10 月 3 日
編集済み: Azzi Abdelmalek 2014 年 10 月 3 日

2 投票

pas=0.1
t=log(3):pas:log(10)
out=exp(t)
%or
n=10 % number of samples
out=exp(linspace(log(3),log(10),n))

5 件のコメント

Nuchto
Nuchto 2014 年 10 月 3 日
Thanks, but isn't this an exponential curve?
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 10 月 3 日
What do you mean?
Nuchto
Nuchto 2014 年 10 月 3 日
In other words, how would you then create an exponentially spaced vector? Thanks in advance.
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 10 月 3 日
n=10 % number of samples
out=log(linspace(exp(3),exp(10),n))
Nuchto
Nuchto 2014 年 10 月 3 日
Thank you!

サインインしてコメントする。

その他の回答 (2 件)

Nathan Porter
Nathan Porter 2017 年 4 月 7 日

5 投票

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
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
Marco 2014 年 10 月 3 日

1 投票

To my knwoledge you could just use the built-in command logspace.

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by