Plotting the Contour of the Solution of the Laplace Equation
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I would like some guidance as to how to input this equation into MATLAB. How can I plot the contour of this function using a grid with different values of x and y with parameters Vo = 1, a = 1, and b = 1.1, for example.
0 comentarios
Respuestas (1)
Christiaan
el 17 de Jun. de 2015
Editada: Christiaan
el 17 de Jun. de 2015
Dear Jack,
In the code below, you find a small code that could help you to plot your the laplacian function.
However note that if you take n infinite, then many numbers go to -Inf or +Inf.
Kind regards, Christiaan
clc;clear all;close all;
range = 10; accuracy = 200;
X = linspace(-range,range,accuracy);
Y = linspace(-range,range,accuracy);
V0 = 1; a = 1;
b = 1.1;
for i = 1:length(X)
for j = 1:length(Y)
x = X(i);
y = Y(j);
V(i,j) = 0;
for n=1:2:1500
V(i,j) = V(i,j) + sinh(n*pi*(a-x)/b)/(n*sinh(n*pi*a/b))*sin(n*pi/b*y);
end
end
end
GRAD = gradient(V);
mesh(X,Y,V,GRAD)
0 comentarios
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!