作者Ecampus (7.7)
看板MATLAB
標題[討論] 請問 如何寫 同時跑3列數字的對角矩陣
時間Tue Sep 26 17:21:53 2017
如果是[ A B C 0 0 0
0 A B C 0 0
0 0 A B C 0
0 0 0 A B C ]
初學者 求問
這有matlab套裝內建可以用嗎
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.230.93.142
※ 文章網址: https://webptt.com/m.aspx?n=bbs/MATLAB/M.1506417716.A.FDF.html
1F:→ LiamIssac: 先把ABC定義好 矩陣照著打就好了 09/26 18:30
2F:推 profyang: A是純量的話 用[diag(A*ones(4,1)),zeros(4,2)]這樣去弄 09/26 18:47
3F:→ profyang: 不對等等 用[A*eye(4),zeros(4,2)]就可了 09/26 18:48
4F:→ Ecampus: !! 感謝 初學 我程式SENSE太差ㄏㄏ 09/26 18:53
5F:→ YoursEver: toeplitz matrix; just call "toeplitz" please. 09/27 08:40
6F:→ YoursEver: or: gg=[1 2 3]; hh=eye(10); ff=conv2(hh,gg,'same') 09/27 08:46
7F:→ YoursEver: then, modify ff to obtain the matrix you need. 09/27 08:46
8F:→ Ecampus: 我後來把A B C各自寫成對角線矩陣 再把B和C做移位 09/29 01:49
9F:→ Ecampus: 然後相加XD... 09/29 01:49
10F:→ YoursEver: 要看你的用途,如果你是要把1D convolution kernel套在 09/29 08:02
11F:→ YoursEver: matrix form寫成數學式來表示,計算並藉此推導closed 09/29 08:04
12F:→ YoursEver: form的話,最後的計算免不了要使用toeplitz matrix, 09/29 08:04
13F:→ YoursEver: 那麼,靠系統化一點的方式來產生大矩陣才會更恰當. 09/29 08:06
14F:→ Ecampus: 3Q 我再練習一下 10/05 23:39