Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How to pad a matrix with a vector instead of a single value
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
madhan ravi
el 17 de Mzo. de 2019
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
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!