MATLAB Multiplications of functions in Matlab

  • Thread starter Thread starter mech-eng
  • Start date Start date
  • Tags Tags
    Functions Matlab
AI Thread Summary
The issue arises from attempting to perform matrix multiplication instead of element-wise multiplication in MATLAB. To resolve the error "Inner matrix dimensions must agree," it is necessary to use the element-wise multiplication operator `.*` instead of the standard multiplication operator `*`. This adjustment allows for the correct calculation of the expression f=exp(-t).*sin(t). Once this change is made, plotting the graph using plot(x,y) should work without errors.
mech-eng
Messages
825
Reaction score
13
Hi. When I try to this multiplication: t=[0:0.02:1]; f=exp(-t)*sin(t)
Error using *
Inner matrix dimensions must agree.

in Matlab I take the error above and I can not also plot its graph by plot(x,y). Can somebody help me?
 
Physics news on Phys.org
You need to use .* to perform element-wise multiplication on each element of these vectors.
 

Similar threads

Replies
4
Views
4K
Replies
8
Views
2K
Replies
5
Views
2K
Replies
4
Views
1K
Replies
5
Views
2K
Replies
1
Views
2K
Replies
5
Views
3K
Replies
4
Views
2K
Back
Top