How to calculate (or plot) a serie with two independent variables?

1 view (last 30 days)
Hi every one, I would appreciate if you let me know how can I plot this function knowing that
  • L=1 &
  • both x and y are real numbers 0<x<L & 0<y<L
  • n is integer (1->inf)
  • f(x)=exp(-(x-L/2)^2/b) where b can be any constant
Here is my code, which didn't work (sorry new to MATLAB):
x=0:0.1:1;
y=0:0.1:1;
L =1;
symsum n x y
c=symsum((2./(sinh(n*pi)*L))*(sin((n*pi*x)./L))*(sin((n*pi*x)./L))*((sinh((n*pi*y)./L))),n,0,L)

Answers (1)

Mahesh Pai
Mahesh Pai on 26 Oct 2016
It is my understanding that you would like to know how to plot a "symsum" expression containing two independent variables.
You can use the "ezsurf" function for MATLAB versions prior to R2016a or use the "fsurf" function for MATLAB versions R2016a and R2016b.
The following example will illustrate how to achieve plotting of a "symsum" symbolic expression using "ezsurf". For MATLAB versions R2016a and R2016b, you can replace "ezsurf" with "fsurf":
syms x t n
u = (80/pi)*symsum(exp(-(2*n-1)^2*pi^2*t/2500)*sin((2*n-1)*pi*x/50)/(2*n-1),n,1,20);
ezsurf(u,[0 250 0 50])
title('')
Refer to the following documentation for more information on "ezsurf" and "fsurf" functions:

Community Treasure Hunt

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

Start Hunting!