# How can I perform combinatorics in MATLAB?

2 views (last 30 days)
Joel Schelander on 23 Mar 2021
I have 16 Appartments and 4 BEVs. This loop gives how much the maximum elextricity load of the household(Appartment) increases.
The load profiles are 'Appartment' or 'HH' for the appartments and 'BEV' for the BEVs. I have one condition saying if the household has 3 or more inhabitants, it is possible to own 2 vehicles.
nHousehold=16;
nBEV=4;
HHPerson=[4 2 4 2 1 2 4 1 2 4 2 1 2 2 3 1];
for i = 1:nHousehold
I=[];
HH = Appartment(:, i);
for j = 1:nBEV
%If the household has three or more inhabitants then there can be
%two vehicles
if HHPerson(i)>=3
for k=1:nBEV
if k==j
Vehicle=BEV(:, j);
I(j,k) = max(HH+Vehicle)./max(HH);
continue
end
Vehicle=BEV(:, j)+BEV(:, k);
I(j,k) = max(HH+Vehicle)./max(HH);
end
elseif HHPerson(i)<3
Vehicle=BEV(:, j);
I(j) = max(HH+Vehicle)./max(HH);
end
end
%This cell contain one matrix for each household, that express
%how much the demand will increase with one or two vehicles, all possible combinations
end
Now I want to use combinatorics to find out how much the total load of 2 households increases and then 3,4,5...16 households.
How can I do this? I attached the INCREASELOAD cell array

R2019a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!