필터 지우기
필터 지우기

Picking a particular column to norm in matrix

조회 수: 1 (최근 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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by