MATLAB: Error using * Inner matrix dimensions must agree.

error using * inner matrix dimensions must agree.

I do not know why this does not works.
clc
clear
t=0:0.5:50;
%Grafica de y(t)=x1(t) y x2(t)
x1= 1 - (exp(-(t/4)))*(cos(0.322748612*t))-((1/2)/sqrt(5/48))*(exp((-t/4)))*(sin(0.322748612*t));
x2= ((1/6)/sqrt(5/48))*exp((-t/4))*sin(sqrt(5/48));
subplot(2,1,1);
plot(t,x1)
grid on;
subplot(2,1,2);
plot(t,x2);
grid on

Best Answer

Use element-wise operators (with the dot .) instead of matrix operators (without the dot .), e.g.,
x1= 1 - (exp(-(t/4))).*(cos(0.322748612*t))-((1/2)/sqrt(5/48))*(exp((-t/4))).*(sin(0.322748612*t));