-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency to Statistics Toolbox
Removed the use of normrnd, poissrnd and prctile from the code for users without Statistical toolbox Resolves: #6
- Loading branch information
AnderBiguri
authored and
AnderBiguri
committed
Jul 15, 2016
1 parent
22446a8
commit 75c4438
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function tf = areTheseToolboxesInstalled(requiredToolboxes) | ||
%ARETHESETOOLBOXESINSTALLED takes a cell array of toolbox names and checks whether they are currently installed | ||
% SYNOPSIS tf = areTheseToolboxesInstalled(requiredToolboxes) | ||
% | ||
% INPUT requiredToolboxes: cell array with toolbox names to test for. Eg. | ||
% {'MATLAB','Image Processing Toolbox'} | ||
% | ||
% OUTPUT tf: true or false if the required toolboxes are installed or not | ||
%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% http://stackoverflow.com/a/2061075/1485872 | ||
|
||
% get all installed toolbox names | ||
v = ver; | ||
% collect the names in a cell array | ||
[installedToolboxes{1:length(v)}] = deal(v.Name); | ||
|
||
% check | ||
tf = all(ismember(requiredToolboxes,installedToolboxes)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function km=poissonrandom(lambda) | ||
|
||
% Donald Knuth's poisson random generator | ||
|
||
% This sucks bananas because its O(lambda) and we want lambda~=10000... | ||
|
||
km=zeros(size(lambda)); | ||
for ii=1:numel(lambda) | ||
|
||
L=exp(-lambda(ii)); | ||
k=1; | ||
p=1*rand; | ||
|
||
while p>L | ||
k=k+1; | ||
p=p*rand; | ||
end | ||
km(ii)=k-1; | ||
end | ||
end |