Plotting the Contour of the Solution of the Laplace Equation
10 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Christiaan
on 17 Jun 2015
Edited: Christiaan
on 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)
0 Comments
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!