Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to pad a matrix with a vector instead of a single value

2 ビュー (過去 30 日間)
Vincent Gambuzza
Vincent Gambuzza 2019 年 3 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
How would I go from two vectors and a matrix to a larger matrix surrounded by these vectors on the top and right side?
xcoeff = [0,0.25,0.5,0.75,1]
ycoeff = [0,0.25,0.5,0.75,1]
Tinside = [0.42 0.54 0.42
0.54 0.70 0.54
0.42 0.54 0.42]
And result in the 5x5 matrix. The top left corner is not that important becasue it will always be 1*1 which is just equal to 1, so they do not have to be multiplied. It could just be a 1.
Tfinal =
[0 0.25 0.5 0.75 1*1
0 0.42 0.54 0.42 0.75
0 0.54 0.70 0.54 0.5
0 0.42 0.54 0.42 0.25
0 0 0 0 0 ]
  1 件のコメント
madhan ravi
madhan ravi 2019 年 3 月 17 日
Not sure if it's for general cases:
Tfinal=toeplitz(xcoeff,ycoeff);
n=numel(xcoeff);
[M,N]=size(Tinside);
Tfinal(n-M:n-1,n-N:n-1)=Tinside;
Tfinal(:,1)=0;
Tfinal(end,:)=0

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by