Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. function [M,B]=genMatrix(n)
  2.  
  3. M=zeros(n,n) + diag(3* ones(1,n)) + diag(-1* ones(1,n-1),1) + diag( -1* ones(1,n-1),-1);
  4. col=zeros(1,n);
  5. col(1)=2.5;
  6. col(n)=2.5;
  7. col(n/2)=1;
  8. col(n/2+1)=1;
  9. for i=1:n
  10. if(i~=(n/2) && i~=(n/2+1))
  11. M(i,n+1-i)=1/2;
  12. end
  13. if(col(i)==0)
  14. col(i)=1.5;
  15. end
  16. end
  17.  
  18. B=transpose(col);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement