Plotting the Contour of the Solution of the Laplace Equation

8 vues (au cours des 30 derniers jours)
Jack Zhang
Jack Zhang le 17 Juin 2015
Modifié(e) : Christiaan le 17 Juin 2015
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.

Réponses (1)

Christiaan
Christiaan le 17 Juin 2015
Modifié(e) : Christiaan le 17 Juin 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)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by