Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Donrad
Donrad el 20 de Oct. de 2016
Respondida: Mahesh Pai el 26 de Oct. de 2016
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)

Respuestas (1)

Mahesh Pai
Mahesh Pai el 26 de Oct. de 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:

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by