MATLAB: What’s wrong with the folow expression

*wrong expression

Matlab don't accept y=exp(-x)+exp(-0.5*x)*(-0.5*cos(3*x)-3*sin(3*x))
Error using * Inner matrix dimensions must agree.
what's wrong with this?

Best Answer

Use .*
x=0:10
y=exp(-x)+exp(-0.5*x).*(-0.5*cos(3*x)-3*sin(3*x))
Related Question