How to plot this exponential signal?

6 visualizaciones (últimos 30 días)
Henri Urushihara
Henri Urushihara el 17 de Sept. de 2021
Respondida: Star Strider el 17 de Sept. de 2021
I keep getting an error when I try to run this section of code in Matlab for signal generation.
x=exp(-0.1*t)*sin(0.6*t);
It says "Error using *
Incorrect dimensions for matrix multiplication. Check that
the number of columns in the first matrix matches the
number of rows in the second matrix. To perform elementwise
multiplication, use '.*'."
Please help as this is for a lab. Thank you!

Respuestas (1)

Star Strider
Star Strider el 17 de Sept. de 2021
The error message is spot on!
Use element-wise multiplication ...
x=exp(-0.1*t)*sin(0.6*t);
↑ ← HERE
so with that correction ....
x=exp(-0.1*t).*sin(0.6*t);
it should work correctly.
See Array vs. Matrix Operations for an extended discussion.
.

Categorías

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

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by