Borrar filtros
Borrar filtros

Why this message appears?

1 visualización (últimos 30 días)
taher zaouali
taher zaouali el 1 de Mayo de 2019
Comentada: Star Strider el 4 de Mayo de 2019
clear all;
f1=200;
f2=250;
a1=1;
a2=1.5;
fe=10e3;
temps=0:1/fe:0.02-1/fe;
m1=a1*sin(2*pi*f1*temps);
m2=a2*sin(2*pi*f2*temps);
mt=m1*m2;
Error using *
Inner matrix dimensions must agree.

Respuesta aceptada

Star Strider
Star Strider el 1 de Mayo de 2019
It appears because you are multiplying two row vector using matrix mulktiplication.
You need to use element-wise array multiplication (using .* instead of *):
mt = m1 .* m2;
  10 comentarios
taher zaouali
taher zaouali el 4 de Mayo de 2019
I've figured it out:
spec_mt=fft(mt,n);
plot(freqs,abs(spec_mt));grid;
the comma is between 2 parts of the fft not of the abs.
Thanks for the help.
Star Strider
Star Strider el 4 de Mayo de 2019
As always, my pleasure.
I took the ‘n’ out of the fft call entirely. I was not certain where you wanted to put the ‘n’, or what you wanted to do with it. If ‘n’ is the same as the size as the time-domain vector, using it as the size of the fft does not change anything, because the length of the time-domain vector is the default length of the fft for that vector.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Measurements and Spatial Audio en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by