martaczaska

Metody Numeryczne lab 1 ver. 2

Mar 8th, 2021
922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.30 KB | None | 0 0
  1. % Lab 1.
  2. % Marta Trzaska 171632 SiSR
  3.  
  4. clc
  5. clear all
  6.  
  7. g = 1; % [S]; g = 1/R
  8. i = 1; % [A]
  9.  
  10. N = 10; %iloΕ›Δ‡ opornikΓ³w
  11. %N = 1000;
  12.  
  13. G = (-g)*diag(ones(1, N-1), -1) + (g+g)*eye(N, N) + (-g)*diag(ones(1, N-1), 1);
  14. G(1,1) = g;
  15.  
  16. I = zeros(N,1);
  17. I(1,1) = i;
  18.  
  19. % G * V = I  --> V = G \ I
  20. V = G \ I;
  21.  
Advertisement
Add Comment
Please, Sign In to add comment