Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Use all possible pairs of two arrays?

Status
Not open for further replies.

ucreate

Newbie level 3
Joined
May 13, 2016
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
26
Hello I'm having trouble with a seemingly simple problem.

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:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top