rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
blowup_matrix.m
1 function A=blowup_matrix(A)
2 % function A=blowup_matrix(A)
3 %
4 % function inserts a row and a column of zeros between all rows and columns
5 % i.e. A=[1,2;3,4] becomes A=[1,0,2; 0,0,0; 3,0,4]
6 
7 [z,s]=size(A);
8 
9 % Zeilen Aufblähen
10 for i=1:z-1
11  A_up = A(1:(2*i-1),:);
12  A_down = A((2*i):end,:);
13  A=[A_up; zeros(1,s);A_down];
14 end
15 
16 % Spalten aufblähen
17 for i=1:s-1
18  A_left = A(:,1:(2*i-1));
19  A_right = A(:,(2*i):end);
20  A=[A_left, zeros(2*z-1,1), A_right];
21 end
22