Plotting the Contour of the Solution of the Laplace Equation

11 ビュー (過去 30 日間)
Jack Zhang
Jack Zhang 2015 年 6 月 17 日
編集済み: Christiaan 2015 年 6 月 17 日
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.

回答 (1 件)

Christiaan
Christiaan 2015 年 6 月 17 日
編集済み: Christiaan 2015 年 6 月 17 日
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)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by