how to find total combination of 5 elements in composition?

조회 수: 1 (최근 30일)
Majid Vaghari
Majid Vaghari 2022년 1월 20일
댓글: Majid Vaghari 2022년 1월 20일
I’m trying to find to total combination of numbers for a quinary alloys that contains 5 elements. The composition of each element can change between 1at% to 96at%.
1≤X1≤96
1≤X2≤96
1≤X3≤96
1≤X4≤96
1≤X5≤96
X1+ X2+X3+X4+ X5=100
For example one easy solution is:1-1-1-1-96
As you know the sum of composition should be 100%.
How can I find the total combination with matlab code?
  댓글 수: 2
Majid Vaghari
Majid Vaghari 2022년 1월 20일
the step of change is 1%
Rik
Rik 2022년 1월 20일
Do you need to generate every combination, or do you just want the total count?

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2022년 1월 20일
편집: Matt J 2022년 1월 20일
Here's an old routine from John D'Errico. I can't find it on the File Exchange anymore, for some reason.
combinations=diophantine([1,1,1,1,1],100,1:96);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by