Plotting the Contour of the Solution of the Laplace Equation

10 Ansichten (letzte 30 Tage)
Jack Zhang
Jack Zhang am 17 Jun. 2015
Bearbeitet: Christiaan am 17 Jun. 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.

Antworten (1)

Christiaan
Christiaan am 17 Jun. 2015
Bearbeitet: Christiaan am 17 Jun. 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)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by