ucreate
Newbie level 3
Hello I'm having trouble with a seemingly simple problem.
I want to use all the combinations of arr1 and arr2 arrays to solve the Result equation and print out the following table:
and so on.. but not all the combinations are used when I try this approach. What should I do to get all the possible combinations?
Thanks
Code:
A = nchoosek(0:15, 2)
arr1 = A(:,1);
arr2 = A(:,2);
Result = arr1.*arr2 + arr1.^2 + arr2.^2;
I want to use all the combinations of arr1 and arr2 arrays to solve the Result equation and print out the following table:
arr1 arr2 Result
0 0 0
1 1 3
2 0 2
and so on.. but not all the combinations are used when I try this approach. What should I do to get all the possible combinations?
Thanks
Last edited by a moderator: