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

 採用された回答

James Tursa
James Tursa 2020 年 4 月 29 日

0 投票

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));

1 件のコメント

Mariana Chávez Gudiño
Mariana Chávez Gudiño 2020 年 4 月 29 日
Thank u so much. My best regars from Mexico.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by