From linear to logarithmic distribution
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponses (1)
Walter Roberson
le 9 Juin 2015
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 commentaires
Mohamed Abdalmoaty
le 9 Juin 2015
Modifié(e) : Walter Roberson
le 10 Juin 2015
Walter Roberson
le 10 Juin 2015
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.
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!