Guest User

Untitled

a guest
Feb 11th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. N = 1;
  2.  
  3. A = -2*eye(N); % N tells how many rows and columns in the matrix
  4. L = 5;
  5. K = 1;
  6. % R = K/delta_X^2 (1)
  7. %L = N*delta_x (2)
  8. % => delta_x = L / N (3)
  9. % (2) + (3) => R = K/((L/N)*(L/N))
  10. R = K/((L/N)*(L/N));
  11. L1 = [1:N-1]*0; % 1xN-1 = [0 0 0 0 ... ] n-1 klp
  12. L2 = [1:N]'*0;
  13. R1 = [L2 [eye(N-1); L1]];
  14. R2 = R1';
  15. A(N,N) = -1;
  16. A = R*(A+R1+R2);
  17.  
  18. % B matrix
  19. B = L2;
  20. B(1) = R; %B = [R 0 0 0...0]
  21. C = L2' % L2 Transpose
Add Comment
Please, Sign In to add comment