Multiplication of 2 sets to get all possible outcomes

1 view (last 30 days)
Hello everyone!
I've been wondering how can I have all posible multiplication outcomes of 2 sets of numbers:
a = 0:0.01:0.2;
b = 0:pi/12:pi;
I want to know all 273 possible multiplications between a and b:
a*sin(b)
Does anyone have an idea how to make it?

Accepted Answer

David Hill
David Hill on 22 Jan 2021
Edited: David Hill on 22 Jan 2021
a = 0:0.01:0.2;
b = 0:pi/12:pi;
[A,B]=meshgrid(a,sin(b));
C=A.*B;
c=unique(C(:)');%if you only want unique outcomes.

More Answers (1)

James Tursa
James Tursa on 22 Jan 2021
This is a simple outer product:
c = a' * sin(b);

Categories

Find more on Resizing and Reshaping Matrices 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!