Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %IFPB 30/11/2017 - METODO DAS DIFERENÇAS FINITAS
- %EQUACAO DE LAPLACE COM CONDICOES DE CONTORNO DE DIRICHLET
- close all, clear all, clc;
- % malha computacional bidimensional
- p = 100; q = 100; %linhaXcoluna
- %condicoes de contorno
- V = zeros (p,q);
- V(1,:) = 100; V(q,:) = 100;
- %equacao de diferencas
- for iter = 1:1000
- for i = 2:p-1
- for j = 2:q-1
- V(i,j) = 0.25*(V(i+1,j)+V(i-1,j)+V(i,j+1)+V(i,j-1));
- end
- end
- end
- %saida grafica
- ss = get(0, 'ScreenSize');
- fig1 = figure(1); ax = axes;
- set(fig1, 'Position',ss,'Color',[1 1 1]);
- set(ax, 'FontName', 'Verdana', 'FontSize', 16)
- mesh(V)
- label(1) = xlabel('x');
- label(2) = ylabel('y');
- label(3) = zlabel('V(x,y)');
- label(4) = title('Equacao de Laplace: Vxx - Vyy = 0');
- label(5) = legend('Diferencas Finitas',1);
- set(label,'FontSize',16);
- drawnow,pause(1)
- fig2 = figure(2); %linhas equipotenciais
- set(fig2,'Position',ss,'Color',[1 1 1]);
- [cs,h] = contour(V);
- clabel(cs,h,'FontSize',15,'Color','k','Rotation',0)
- label(1) = xlabel('x');
- label(2) = ylabel('y');
- label(3) = zlabel('u(x,y)');
- label(4) = title('Equacao de Laplace: Vxx - Vyy = 0');
- label(5) = legend('Diferencas Finitas',1);
- set(label,'FontSize',16);
- drawnow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement