Skip to content

Instantly share code, notes, and snippets.

@IPlayZed
Created October 16, 2020 18:06
Show Gist options
  • Save IPlayZed/b240865b9433d6c001fb87366b0f1e61 to your computer and use it in GitHub Desktop.
Save IPlayZed/b240865b9433d6c001fb87366b0f1e61 to your computer and use it in GitHub Desktop.
MATLAB function for creating logarithmically spaced row vector, with given length, between given numbers.
%Written by Balázs Börcsök, as of 12/10/2020.
%Licensed under GNU GPL v2: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
function generatedArray=logarithmicIntervalN(low,high,N)
lowLog=log10(low);
highLog=log10(high);
step=(highLog-lowLog)/N;
exponentArray=lowLog:step:highLog;
[~,expArraySize]=size(exponentArray);
logarithmicSizedArray=(ones(1,expArraySize).*10).^exponentArray;
generatedArray=logarithmicSizedArray;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment