Error: 'Matrix dimensions must agree' even when using a scalar to multiply with Matrix.
Mostrar comentarios más antiguos
Hello, I am actually multiplying the matrix with a scalar, if I however take the user input for the scalar it displays error as :* Error using '*' Inner matrix dimensions must agree.*
Part of my code that uses this is:
scale = ('Enter the scale for noise to be added to the signal, scale = ');
n=linspace(0,2*pi,N);
s=sin(2*pi*n);
v=randn(1,N);
x=s+v*scale;
However if I implicitly mention the scalar in m-file it works perfectly. The following code works:
scale = 0.2;
n=linspace(0,2*pi,N);
s=sin(2*pi*n);
v=randn(1,N);
x=s+v*scale;
I am a noob, so please be gentle. Any help would be appreciated. Thank you!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!