Info
This question is closed. Reopen it to edit or answer.
Error using * Inner matrix dimensions must agree.
1 view (last 30 days)
Show older comments
Não consigo enteder porque aparece esse erro. Só que esse progrma não tem matriz.
clc
w=5.8178; t0 = 1; y1 = 0.05;
m=1200;k=400000;c=21908.88;
wn=sqrt(k/m);
cc=2*m*wn;
eta=c/cc;
wd = wn*(sqrt(1-eta^2));
o = atan((c*w)/k-(m*(w^2)));
n = 100;%pontos a gerar
t = linspace(0,10,n);%vetor tempo
y = y1*(exp(-wn*eta*t))*sin(sqrt(1-(eta^2))*wn*t + o)+((2*y1)/(k*t0))*((t^2)-(c/k))+((-2*y1)/(k*t0))*((t^2)-(c/k))+2*y1;%vetor saida
figure(1),plot(t,y),grid
0 Comments
Answers (1)
Walter Roberson
on 25 Nov 2019
Change all of your * to .* and all of your / to ./ and all of your ^ to .^
In MATLAB, * is algebraic matrix multiplication ("inner product"), and / is matrix division (A/B is much like A*pinv(B)), and ^ is matrix exponential, repeated algebraic matrix multiplication.
0 Comments
This question is closed.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!