when i run this programme which is a decomposition lu i get Error using / Arguments must be numeric, char, or logical. Error in untitled2 (line 10) L(:,1) = A(:,1)/U(1,1);
Afficher commentaires plus anciens
A=("entrer le scoeficients de votre matrice");
B=("entrer le vecteur");
N=length(A);
L=zeros(N,N);
U=zeros(N,N);
for a=1:N
L(a,a) = 1;
end
U(1,:) = A(1,:);
L(:,1) = A(:,1)/U(1,1);
for i=2:N
for j=i:N
U(i,j) = A(i,j) - L(i,1:i-1)*U(1:i-1,j);
end
for k=i+1:N
L(k,i) =(A(k,i) - L(k,1:i-1)* U(1:i-1,i))/U(i,i);
end
end
L;U;
Y=zeros(N,1);
Y(1) = B(1)/L(1,1);
for k=2:N
Y(k)=B(k)-L(k,1);
end
Y;
X=zeros(N,1);
X(N)=Y(N)/U(N,N);
for k=N-1:-1:1
X(k)=(Y(k)-U(k,k+1:N)*X(k+1:N))/U(k,k);
end
Réponses (1)
Catégories
En savoir plus sur Powertrain Blockset dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!