Hello, I have cycle to represents b as matrix.
m=[]; b=[4]; for i=0:6 %Creating cycle
b=circshift(b,[0,i]); %Shift b
z=zeros(1,7,'int8'); %Create zeros string to represents b as 0 0 0...b..0
if b==0 %If b=0 then z=1 0 0...0
z(1)=1; m=[m; z]; else z(b)=b; b=mod(b,7); b=b+1; m=[m; z]; end endANSWER: m = 0 0 0 4 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 7 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 3 0 0 0 0
I need to create the cycle for represent matrix b, for example, b=[1 2; 5 6] . In the form matrix m dimension 7*2×7*2=14×14. Only necessary that each value of b displayed by its matrix m For example, for b=[1 2; 3 4], I need create the following m:
m = 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 2 0 0 0 0 0 0 0 3 0 0 0 0 0 0 3 0 0 0 0 0 0 0 4 0 0 0 0 0 0 4 0 0 0 0 0 0 0 5 0 0 0 0 0 0 5 0 0 0 0 0 0 0 6 0 0 0 0 0 0 6 0 0 0 0 0 0 0 7 0 0 0 0 0 0 7 1 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 6 0 0 0 0 0 0 6 0 0 0 0 0 0 0 7 0 0 0 0 0 0 7 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 2 0 0 0 0 0 0 0 3 0 0 0 0 0 0 3 0 0 0 0 0 0 0 4 0 0 0 0 0 0 4 0 0 0 0 0 0 0 5 0 0
Help me, please!
Best Answer