Clear Filters
Clear Filters

Waterfall plot of an integral

2 views (last 30 days)
Andrew Heinrich
Andrew Heinrich on 11 Feb 2019
Answered: Raghav Singhal on 27 Feb 2019
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)

Answers (1)

Raghav Singhal
Raghav Singhal on 27 Feb 2019
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.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!