Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to pad a matrix with a vector instead of a single value
2 次查看(过去 30 天)
显示 更早的评论
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
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!