Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Parâmetros
- u1 = 1; % Condição inicial
- phi = 1; % Porosidade
- V = 1; % Velocidade
- L = 1; % Comprimento do domínio (0,L)
- T = 1; % Tempo Final
- n = 100; % Número de pontos
- dx = L / (n - 1);
- x = linspace(0, L, n); % Malha espacial
- dt = 0.01;
- t = 0:dt:T; % Malha temporal
- % Inicialização da matriz B com as condições iniciais
- B = zeros(n, 1);
- B(1) = u1;
- % Inicialização da matriz A
- A = zeros(n, n);
- A(1, 1) = 1;
- % Coeficientes da matriz A
- A1 = -(V*dt/(phi*dx));
- A2 = 1 + V*dt/(phi*dx);
- for i = 2:n - 1
- A(i, i - 1) = A1;
- A(i, i) = A2;
- end
- % Solução dos sistemas A*u = B
- figure; % Criação da figura
- for j = 2:length(t)
- u = A\B;
- B = u;
- plot(x, u);
- hold on;
- end
- xlabel('x');
- ylabel('u');
- title('Solução usando Volumes Finitos - Implícito');
- legend('t=0.1', 't=0.2', 't=0.3', 't=0.4', 't=0.5', 't=0.6', 't=0.7', 't=0.8', 't=0.9', 't=1.0');
- grid on;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement