The results display problem

1 Ansicht (letzte 30 Tage)
Jiapeng
Jiapeng am 21 Nov. 2022
Beantwortet: David Hill am 21 Nov. 2022
My code ishere. How about displaying every x and r from 1 to 4?
A= [1.02 0.95 0.77 0.67 0.56 0.30 0.16 0.01];
b = [0.39 0.32 0.22 0.18 0.15 0.12 0.13 0.15];
for i = 1:4
num = 10.^(-i);
A = A+num;
b = b+num;
[U,S,V] = svd(A,0);
x = V.*(S.^(-1)).*U';
r = rank(A);
end
disp(x);
disp(r);

Akzeptierte Antwort

David Hill
David Hill am 21 Nov. 2022
A= [1.02 0.95 0.77 0.67 0.56 0.30 0.16 0.01];
b = [0.39 0.32 0.22 0.18 0.15 0.12 0.13 0.15];
for i = 1:4
num = 10.^(-i);
A = A+num;
b = b+num;
[U,S,V] = svd(A,0);
x(:,:,i) = V.*(S.^(-1)).*U';
r(i)= rank(A);
end
disp(x);
(:,:,1) = 0.2556 -Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.2396 Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.1985 -Inf Inf -Inf -Inf -Inf -Inf -Inf 0.1757 -Inf -Inf Inf -Inf -Inf -Inf -Inf 0.1506 -Inf -Inf -Inf Inf -Inf -Inf -Inf 0.0913 -Inf -Inf -Inf -Inf Inf -Inf -Inf 0.0593 -Inf -Inf -Inf -Inf -Inf Inf -Inf 0.0251 -Inf -Inf -Inf -Inf -Inf -Inf Inf (:,:,2) = 0.2518 -Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.2362 Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.1961 -Inf Inf -Inf -Inf -Inf -Inf -Inf 0.1738 -Inf -Inf Inf -Inf -Inf -Inf -Inf 0.1493 -Inf -Inf -Inf Inf -Inf -Inf -Inf 0.0914 -Inf -Inf -Inf -Inf Inf -Inf -Inf 0.0602 -Inf -Inf -Inf -Inf -Inf Inf -Inf 0.0267 -Inf -Inf -Inf -Inf -Inf -Inf Inf (:,:,3) = 0.2514 -Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.2359 Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.1959 -Inf Inf -Inf -Inf -Inf -Inf -Inf 0.1736 -Inf -Inf Inf -Inf -Inf -Inf -Inf 0.1492 -Inf -Inf -Inf Inf -Inf -Inf -Inf 0.0914 -Inf -Inf -Inf -Inf Inf -Inf -Inf 0.0602 -Inf -Inf -Inf -Inf -Inf Inf -Inf 0.0269 -Inf -Inf -Inf -Inf -Inf -Inf Inf (:,:,4) = 0.2514 -Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.2358 Inf -Inf -Inf -Inf -Inf -Inf -Inf 0.1958 -Inf Inf -Inf -Inf -Inf -Inf -Inf 0.1736 -Inf -Inf Inf -Inf -Inf -Inf -Inf 0.1492 -Inf -Inf -Inf Inf -Inf -Inf -Inf 0.0914 -Inf -Inf -Inf -Inf Inf -Inf -Inf 0.0603 -Inf -Inf -Inf -Inf -Inf Inf -Inf 0.0269 -Inf -Inf -Inf -Inf -Inf -Inf Inf
disp(r);
1 1 1 1

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by