this one helps. The only difference between linspace and logspace is that they go one step further and take the power of 10 for every element in the linspace array. As such, you'd simply take your equation for linspace you generated, take the result and raise it to the power of 10. However, with your code, you are relying on the previous result and that is already raised to the power of 10. Therefore, you'll need to take the antilog to convert the previous result back to a linear form, then use the same logic was used to generate the linspace, then raise it back to the power of 10. Therefore, the relationship is: code :
xx[n] = 10^(log10(xx[n1]) + ((ba)/(n1)))
xx[n] = xx[n1] * (10^((ba)/(n1)))
a = 1; b = 5; n = 7;
x = logspace(1,5,7);
xx = zeros(1,n); xx(1) = 10^a;
for i=2:n
xx(i) = xx(i1)*(10^((ba)/(n1))); %// Change
end
>> format long g;
>> x
x =
Columns 1 through 4
10 46.4158883361278 215.443469003188 1000
Columns 5 through 7
4641.58883361278 21544.3469003189 100000
>> xx
xx =
Columns 1 through 4
10 46.4158883361278 215.443469003188 1000
Columns 5 through 7
4641.58883361278 21544.3469003188 100000
Share :

Logspace containing specific points (Matlab)
By : user3767776
Date : March 29 2020, 07:55 AM
Hope this helps Perhaps you are doing some sort of plot and what you need is the reference points for those specific values. If that's the case you can also handle the logspace vector separately to the special values, for example, by overlaying two plots. code :
x = logspace(A, B, N);
y = f(x); % (whatever function or manipulation you want)
xSpecial = [25, 50, 75];
ySpecial = f(xSpecial);
plot(x, y); % plot function curve
hold on;
plot(xSpecial, ySpecial, 'ro'); % overlay special points with red circles
xRegular = logspace(A, B, N); % N regular logspace values
xSpecial = [25, 50, 75]; % special particular values
xCombined = [xRegular, xSpecial];
yCombined = f(xCombined); % whatever calculation you are doing
yRegular = yCombined(1:N); % calculated values for xRegular
ySpecial = yCombined(N+1:end); % calculated values for xSpecial
% e.g. plot with special points
plot(xRegular, yRegular);
hold on;
plot(xSpecial, ySpecial, 'ro'); % red circles indicate special points

using linspace in matlab
By : Java777
Date : March 29 2020, 07:55 AM
I hope this helps you . I want to create a vector which runs from 1 to 260 with increments of 360 between every whole number. , Maybe you can just do: code :
n=261;
linspace(1,n,(n1)*360);

does PHP have a function like matlab's linspace?
By : Arslan Khan
Date : March 29 2020, 07:55 AM
To fix this issue I want this to execute the following code in PHP code :
function linspace($i,$f,$n){
$step = ($f$i)/($n1);
return range ($i,$f,$step);
}
$test = linspace(0,3.14159,8);
print_r($test);

Difference in output between numpy linspace and numpy logspace
By : PeterWater
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further 2017 update: The numpy 1.12 includes a function that does exactly what the original question asked, i.e. returns a range between two values evenly sampled in log space. The function is numpy.geomspace code :
>>> np.geomspace(0.02, 2.0, 20)
array([ 0.02 , 0.0254855 , 0.03247553, 0.04138276, 0.05273302,
0.06719637, 0.08562665, 0.1091119 , 0.13903856, 0.17717336,
0.22576758, 0.28768998, 0.36659614, 0.46714429, 0.59527029,
0.75853804, 0.96658605, 1.23169642, 1.56951994, 2. ])

Linspace using matrix input matlab
By : Domen Rupnik
Date : March 29 2020, 07:55 AM

