Picking a particular column to norm in matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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];
da = [1.02+(1.2e-3) 0.95+(6.4e-3) 0.77+(-4.8e-3) 0.67+(2.8e-3) 0.56+(-1.4e-3) 0.30+(3.2e-3) 0.16+(3.6e-3) 0.01+(-9.0e-4)];
db = [0.39+(-4.8e-3) 0.32+(1.9e-3) 0.22+(3.2e-3) 0.18+(4.8e-3) 0.15+(-2.1e-3) 0.12+(2.4e-3) 0.13+(-5.0e-3) 0.15+(2.2e-3)];
for i = 1:4
num = 10.^(-i);
a2 = A+num;
b2 = b+num;
da2 = da+num;
db2 = db+num;
[U1,S1,V1] = svd(a2,0);
[U2,S2,V2] = svd(da2,0);
x1(:,:,i) = V1.*(S1.^(-1)).*(U1').*b2;
x2(:,:,i) = V2.*(S2.^(-1)).*(U2').*db2;
end
disp(x1);
disp(x2);
I want to calculate the norm of the first column of x1 and x2 and show them. But I cannot be able to do it by picking a particular column to norm.
1 commentaire
John D'Errico
le 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];
da = [1.02+(1.2e-3) 0.95+(6.4e-3) 0.77(-4.8e-3) 0.67+(2.8e-3) 0.56+(-1.4e-3) 0.30+(3.2e-3) 0.16+(3.6e-3) 0.01+(-9.0e-4)];
Firtst, you don't need to use parens around numbers. 1.2e-3 is just a number. MATLAB knows it is that.
But you DO need to use an operator. MATLAB does not recognize implicit multiplication or addition.
da = [1.02+(1.2e-3) 0.95+(6.4e-3) 0.77(-4.8e-3) 0.67+(2.8e-3) 0.56+(-1.4e-3) 0.30+(3.2e-3) 0.16+(3.6e-3) 0.01+(-9.0e-4)];
?
Next,
db = [0.39+(-4.8e-3) 0.32+(1.9e-3) 0.22+(3.2e-3) 0.18+(4.8e-3) 0.15+(-2.1e-3) 0.12+(2.4e-3) 0.13+(-5.0e-3) 0.15+(2.2e-3)];
for i = 1:4
num = 10.^(-i);
a2 = A+num;
b2 = b+num;
da2 = da+num;
db2 = db+num;
[U1,S1,V1] = svd(a2,0);
[U2,S2,V2] = svd(da2,0);
x1(:,:,i) = V1.*(S1.^(-1)).*(U1').*b2;
x2(:,:,i) = V2.*(S2.^(-1)).*(U2').*db2;
end
So you are apparently creating 3-dimensional arrays. What is the first column of a 3-dimensional array? What is the second column?
Réponses (1)
Voir également
Catégories
En savoir plus sur Matrix Indexing 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!