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

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

Answers (1)

A=input("entrer le scoeficients de votre matrice");
B=input("entrer le vecteur");

1 Comment

A and B are user inputs which can be done using input function. Otherwise they are string expressions

Sign in to comment.

Categories

Find more on Powertrain Blockset in Help Center and File Exchange

Asked:

on 6 Nov 2022

Commented:

on 6 Nov 2022

Community Treasure Hunt

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

Start Hunting!