matrix multipication per elements and convert to char
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
hi, any solution with this matrix multipication??
pop =
9 0 -2 3 -4
8 -9 1 0 -3
7 -8 9 -1 2
6 -7 8 -9 1
if pop > 0,
m = [2*pop-1 2*pop; 2*pop 2*pop-1];
elseif pop == 0
m = [2*i+1 pop;2*i-1 pop]; % i is number of row's
elseif pop < 0,
m = [2*pop+1 2*pop; 2*pop 2*pop+1];
end
here's a resul's what i need:
17 18 2 0 -3 -4 5 6 -7 -8
18 17 1 0 -4 -3 6 5 -8 -7
15 16 -17 18 2 2 4 0 -5 -6
16 15 -18 -17 2 2 3 0 -6 -5
13 14 -16 -16 17 18 -2 -2 3 4
14 13 -16 -16 18 17 -2 -2 4 3
11 12 -14 -14 16 16 -17 -18 1 2
12 11 -14 -14 16 16 -18 -17 2 1
i appreciate a lot for any attention.. thx before
댓글 수: 4
Friedrich
2012년 3월 7일
If pop is really the matrix above, than none of the formulas for m will generate the matrix you want. Could you explain a bit more how the resulting matrix should be generated? So which laws should be applied on the input matrix?
In addition, your if else brance is never true at all, e.g. this will display never the word true:
if pop > 0
disp('true')
elseif pop == 0
disp('true')
elseif pop < 0
disp('true')
end
So what do you want achive exactly?
Jan
2012년 3월 7일
There was a very similar question some days ago - it used "a" instead of "pop". But I cannot find it anymore. Has it been deleted to increase our confusion?
The operation should happen elementwise, so each element is replaced by [2*pop(i,j)-1, 2*pop(i,j); 2*pop(i,j), 2*pop(i,j)-1]
mashudi
2012년 3월 7일
mashudi
2012년 3월 10일
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!