Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function D = avgArray(M)
- c1=zeros(4,1);
- c4=3:-1:0;
- c4=c4';
- c2_c4r1=[1 1 2 2];
- r3_r4c2_c4=zeros(3,4);
- Mid=[c2_c4r1;r3_r4c2_c4];
- M=horzcat(Mid,c4);
- M=horzcat(c1,M)
- A=[1 -1 -1 0 0 0 0 0;-1 1 0 -1 0 0 0 0;-1 0 1 -1 -1 0 0 0;0 -1 -1 1 0 -1 0 0;0 0 -1 0 1 -1 -1 0;0 0 0 -1 -1 1 0 -1;0 0 0 0 -1 0 1 -1;0 0 0 0 0 -1 -1 1];
- b=[1;0;1;0;2;0;4;1];
- x=b\A;
- M(2,2)=x(1);
- M(3,2)=x(2);
- M(2,3)=x(3);
- M(3,3)=x(4);
- M(2,4)=x(5);
- M(3,4)=x(6);
- M(2,5)=x(7);
- M(3,5)=x(8);
- D=M
- display(M)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement