# [SOLVED]Plotting a sol to a PDE

#### dwsmith

##### Well-known member
$$u(x,y) = \frac{4}{\pi}\sum_{n = 1}^{\infty}\left[\frac{\sin(2n - 1)\pi x\sinh\left[(2n - 1)\pi (1 - y)\right]}{(2n - 1)\sinh(2n - 1)\pi} + \frac{\sin(2n - 1)\pi y\sinh\left[(2n - 1)\pi(1 - x)\right]}{(2n - 1)\sinh(2n - 1)\pi}\right].$$

How do I construct a contour plot of this?

#### dwsmith

##### Well-known member
Code:
>> [x,y]=meshgrid(-10:0.1:10, -10:0.1:10);
>> syms n;
>> z=symsum(4/pi*(sin((2*n-1)*pi*x)*sinh((2*n-1)*pi*(1-y))/((2*n-1)*sinh((2*n-1)*pi))+sin((2*n-1)*pi*y)*sinh((2*n-1)*pi*(1-x))/((2*n-1)*sinh((2*n-1)*pi))),0,20);
contour3(x,y,z)
I just tried this code but Matlab froze.

Any thoughts or suggestions?

#### Sudharaka

##### Well-known member
MHB Math Helper
Code:
>> [x,y]=meshgrid(-10:0.1:10, -10:0.1:10);
>> syms n;
>> z=symsum(4/pi*(sin((2*n-1)*pi*x)*sinh((2*n-1)*pi*(1-y))/((2*n-1)*sinh((2*n-1)*pi))+sin((2*n-1)*pi*y)*sinh((2*n-1)*pi*(1-x))/((2*n-1)*sinh((2*n-1)*pi))),0,20);
contour3(x,y,z)
I just tried this code but Matlab froze.

Any thoughts or suggestions?
I tried this using Maxima. The code I used and the plots are given below.

Code:
expr:sum(4/%pi*(sin((2*n-1)*%pi*x)*sinh((2*n-1)*%pi*(1-y))/((2*n-1)*sinh((2*n-1)*%pi))+sin((2*n-1)*%pi*y)*sinh((2*n-1)*%pi*(1-x))/((2*n-1)*sinh((2*n-1)*%pi))),n,0,20)\$

plot3d(expr, [x,-10,10],[y,-10,10],[grid, 150, 150]);

contour_plot(expr,[x,-15,15],[y,-10,10],[grid, 300, 300]);

3D Plot

Contour Plot

#### dwsmith

##### Well-known member
Is there anyway to plot the vector field of this?

MHB Math Helper