Matrix multiplication error using '.*'
Mostrar comentarios más antiguos
%so this is my simply code
r = randi(100,66);
t = (0:1/55:1);
e = exp(2*pi*i*13*t);
t = r.*e % this gives me error why is it and how can fix
4 comentarios
KSSV
el 17 de Nov. de 2020
Are you looking for this?
%so this is my simply code
t = (0:1/55:1);
r = randi(size(t));
e = exp(2*pi*i*13*t);
t = r.*e % this gives me error why is it and how can fix
AJ Woodson
el 17 de Nov. de 2020
KSSV
el 17 de Nov. de 2020
You see r is a matrix and t is a array..this is what you want?
VBBV
el 17 de Nov. de 2020
@woodson then you have to divide t into 66. as
%if true
t = 0:1/65:1;
To get what you want.
Respuestas (3)
madhan ravi
el 17 de Nov. de 2020
t = linspace(0, 1, 66);
1 comentario
AJ Woodson
el 17 de Nov. de 2020
Walter Roberson
el 17 de Nov. de 2020
0 votos
randi(100,66) creates a 66 x 66 matrix of values 1 to 100.
0:1/55:1 is length 56.
When you .* a 66x66 matrix and a 1x56 matrix then what size of output are you expecting?
1 comentario
AJ Woodson
el 17 de Nov. de 2020
Andrei Bobrov
el 17 de Nov. de 2020
r = randi(100,66);
t = reshape(0:1/55:1,1,1,[]);
e = exp(2*pi*i*13*t);
t = r.*e;
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!