Picking a particular column to norm in matrix

2 ビュー (過去 30 日間)
Jiapeng
Jiapeng 2022 年 11 月 21 日
移動済み: Steven Lord 2022 年 11 月 21 日
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 件のコメント
John D'Errico
John D'Errico 2022 年 11 月 21 日
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?

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2022 年 11 月 21 日
移動済み: Steven Lord 2022 年 11 月 21 日
Consider using the vecnorm function.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by