From linear to logarithmic distribution

5 次查看(过去 30 天)
Given a linear frequency scale denoted by the vector f = 1:fmax; fmax is known, say 1000.
How can I construct, out of this vector, a logarithmic selection of the entries such that the ratio between two consecutive odd numbers is 1.1?

回答(1 个)

Walter Roberson
Walter Roberson 2015-6-9
You cannot. The only solution to x*11/10 = x+2 is x = 20, and that is an even number.
If the task is to construct a vector of length fmax such that the ratio
x(2*k+3)/x(2*k+1)
is 11/10 for k in nonnegative integers, then as logarithmic progression is x(n+1) = C * x(n) for some constant C, it follows that x(n+2) = C*(C*x(n)) = C^2 * x(n). You want that value, C^2 to be 1.1, so your C is sqrt(1.1). Then you get
initial_value * sqrt(1.1).^(0:fmax-1)
  2 个评论
Mohamed Abdalmoaty
编辑:Walter Roberson 2015-6-10
fmax = 1000; Ratio = 1.1;
Lines_linear = 1:fmax/2;
currentIdx = 1; selected = 1;
Lines = 1;
while currentIdx < fmax/2
[~,nextIdx]=min(abs(Lines_linear(currentIdx)*Ratio-...
Lines(currentIdx+1:length(Lines_linear))));
currentIdx = nextIdx+currentIdx;
% a logarithmic step!
if Lines_linear(currentIdx) > sqrt(Ratio)*Lines(length(Lines)),
selected = [selected;currentIdx];
Lines = [ Lines; Lines_linear(currentIdx)];
end
end
Walter Roberson
Walter Roberson 2015-6-10
I have no idea what that code is intended to do. It is uncommented and the relationship to the Question you posted is not obvious.
You start with Lines=1 which is length 1. In the first statement in your while you try to index Lines from 2 to length(Lines_linear) which would be 2:500. But Lines only has 1 entry, so you cannot access elements 2 to 500 of it.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by