Error using * Inner matrix dimensions must agree.
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
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
Réponses (1)
Walter Roberson
le 25 Nov 2019
0 votes
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.
Cette question est clôturée.
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!