Picking a particular column to norm in matrix

2 Ansichten (letzte 30 Tage)
Jiapeng
Jiapeng am 21 Nov. 2022
Verschoben: Steven Lord 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];
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 Kommentar
John D'Errico
John D'Errico 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];
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)];
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
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?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 21 Nov. 2022
Verschoben: Steven Lord am 21 Nov. 2022
Consider using the vecnorm function.

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by