Plotting 3 variable functions (Laplace equation)
Ältere Kommentare anzeigen
CONTOUR PLOTTING OF LAPLACE EQUATION

I wish to plot this equation. The gist that I get is :
- I have to vary x,y and n
- n will have odd numbers only for this arrangement
Accordingly I have typed this out in MATLAB:
clc
clear all
close all
v0=100;
a=5;
b=10;
x=1:1:200;
y=1:1:200;
[x,y]=meshgrid(x,y);
for n=1:2:100
z(n)=(4.*v0./pi).*(sin(n.*pi.*x./a).*(sinh(n.*pi.*y./a)./(n.*sinh(n.*pi.*b./a))));
end
contour3(x,y,z);
From my basic understanding of plotting, I have to index z so that I can keep the values for plotting later. But an error is generated at the z(n) line.The error says,
Subscripted assignment dimension mismatch.
I know this is a matrix size problem, but I am unable to find a feasible solution. How do I solve this size problem? Is there any better way to formulate this equation since it is a 3-variable formula? Or is there any constraint of choosing the range of x,y? If you have a clear explanation and a solution for this, kindly help.
Thanks.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Contour Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

