Multiplication of 2 sets to get all possible outcomes

1 visualización (últimos 30 días)
Assiya Syzdykova
Assiya Syzdykova el 22 de En. de 2021
Respondida: James Tursa el 22 de En. de 2021
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?

Respuesta aceptada

David Hill
David Hill el 22 de En. de 2021
Editada: David Hill el 22 de En. de 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.

Más respuestas (1)

James Tursa
James Tursa el 22 de En. de 2021
This is a simple outer product:
c = a' * sin(b);

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by