行列を計算して,代入をしたいのですが,サイズが異なるためできないといわれてしまいます.教えてください.
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
deltax = 10*(1000 /3600);
eya = Ya; eva = abs(va-V); eyTH = YTH;
eTHw = abs(THw-TH); eTHg = abs(THg-TH);
A = [1,deltaT,0,0,0;0,1,0,0,0;0,0,1,deltax,0;0,0,0,1,0;0,0,0,0,0];
B = [0,0,0,0,0;deltaT,0,0,0,0;0,0,0,0,0;0,deltaT,0,0,0;0,0,1,0,0];
C = [1,0,-1,0,0;0,0,0,1,-1];
X = [eya,eva,eyTH,eTHw,eTHg];
Q = 1.5*10^-6; R = 1.0*10^-7; U = 5.0*10^-3;
q = randn(N,1)*sqrtm(Q);
r = randn(N,1)*sqrtm(R);
u = randn(N,1)*sqrtm(U);
Z = [q;r;u;0;0];
x =[0,0,0,0,0];
for k=2:N
X (k,:) =A*X(k-1,:).'+B*Z(k-1,:).'; %個々の部分でエラーが出てしまします.
end
0 commentaires
Réponses (2)
Image Analyst
le 14 Nov 2024 à 15:30
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
For example, you aren't telling us what Ya, va, V, etc. are Plus you are not giving us the full error message (ALL the red text) so we don't know what line the error occurs on.
Before the loop, have this
whos A
whos X
whos B
whos Z
But X(k-1,:).' is a row vector transposed so that it's now a column vector. But A is a 2-D matrix, so you're doing a matrix multiply, not an element-by-element multiply, So if A is rows x columns, then X(k-1,:).' better be columns x 1 or else it won't work as a matrix multiply. Did you intens an element-by-element multiply? If so use .* rather than *
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!