필터 지우기
필터 지우기

Any one can help me to check this code ?

조회 수: 1 (최근 30일)
Brwa
Brwa 2013년 5월 25일
A = [ 1 1 5; 2 1 6; 3 7 5 ];
B = ones(3,3)
S = eye(3,3)
O = [2 7 6; 3 7 0]
for j = 1: 1: 3
R = A(1:end,j) % get 3 column vectors. therefore i will have 3 (R)'s
C = B * R ; % 3x1 vector
D = [B*S ; O,B*C]
H = [zeros(3,3); S]
end
I have doubt about the value of C, does it change with j in the loop?
by the way C is a matrix, i can not write C(j) because i want to use the whole matrix (3x3) not just some specific values inside C.
If i need to change something, please let me know.
Thanks

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 25일
편집: Azzi Abdelmalek 2013년 5월 25일
There is a small mistake, it should be O' instead of O,
A = [ 1 1 5; 2 1 6; 3 7 5 ];
B = ones(3,3)
S = eye(3,3)
O = [2 7 6; 3 7 0]
for j = 1: 3
R = A(1:end,j) % get 3 column vectors. therefore i will have 3 (R)'s
C = B * R ; % 3x1 vector
D = [B*S ; O' B*C]
H = [zeros(3,3); S]
end
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 25일
Yes C is changing every iteration, if you need to store each value of C , you can add in the loop
C1{j}=C
Brwa
Brwa 2013년 5월 26일
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by