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!