function nchoosek (v,k) very large vector gives Inf
Show older comments
I have a column vector 510 X 1 ( listOfRmsValues) and I want to find all possible combinations taken 30 elements( sampleSize ) at a time . Using nchoose(v,k) gives Inf as v should not be more than 15 as suggested by Matlab as it exceeds the maximum limit Matlab can handle.I even tried using vpi as suggested in other matlab forums but I get an error
Error using vpi/nchoosek (line 46)
n must be scalar, integer >= 1
This is my code snippet
function [ meanVal , stdDev , binomialCoefficient ] = MeanDistribution ( listOfRmsValues ,quantity ,sampleSize )
tic
binomialCoefficient = nchoosek( vpi(quantity) ,sampleSize);
allPossibleCombinations = nchoosek (vpi(listOfRmsValues) , sampleSize); % I get the error oIn this line.
sampleMean = zeros ( binomialCoefficient , 1 );
sampleStdDeviation = zeros ( binomialCoefficient , 1 );
Is vpi not built to handle vectors? If not how can I solve this problem.
I know the number is very huge.Further more,I want to take mean of all combinations too .Can anyone suggest me a solution.
Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!