Waterfall plot of an integral

2 次查看(过去 30 天)
Andrew Heinrich
Andrew Heinrich 2019-2-11
I am attempting to create a waterfall plot of an integrated function where one of the bounds is a variable. I am very new to matlab so I am not sure if the answer is glaringly obvious, but trying different things gets me different errors, either with horzcat or with non-numeric inputs for the waterfall command. Any advice is appreciated.
x = linspace(-3,3,20);
y = linspace(.01,1,20);
T= linspace(0,1,20);
[X,Y]= meshgrid(x,y);
f = (4.*pi.*(Y-T)).^-1/2.*exp(-X.^2./(4.*(Y-T)));
syms T Y
Z= int(f,T,[0 Y]);
figure
waterfall(X,Y,Z)

回答(1 个)

Raghav Singhal
Raghav Singhal 2019-2-27
Hi, the expression 'f' you have defined is of type double, ie it has no variables and hence integrating such an expression wouldnt work. You could try defining the variables used as symbolic beforehand and try. Additionally since you seem to be integrating an expression with three variables, you could try using 'integral3' instead of 'int'.
Doucumentation for the same can be found here. Hope this helps.

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by