Hi there,
I have a surface and want to (numerically) calculate the volume under the surface, but not under the whole surface. Just the volume that corresponds to a closed region on the xy plane. Below there is an example code that draws the surface as well as a little circle-like (however not circle) on the "floor". It is a bit small but visible. I want the volume under the surface for all x,y that lie within that red circle like region.
If I could also draw this "tube" that will rise from the "floor" all the way up to my surface so as to visualize the volume I am calculating (with some transparency or something) would be really great!
Is there a tool for this??
Thank you in advance for any answers!
close all
clear all
clc
m1hat=5;m2hat=6;m3hat=7;
s1hat=1;s2hat=1;s3hat=1;
c1hat=5.5;c2hat=6.5;
[c1,c2] = meshgrid(-10:0.1:10, -10:0.1:10);
t1=normcdf((c1-m1hat)/s1hat);
t2=(c1<c2).*(normcdf((c2-m2hat)/s2hat)-normcdf((c1-m2hat)/s2hat));
t3=1-normcdf((c2-m3hat)/s3hat);
figure
surf(t1,t3,t2)
xlabel('t1');ylabel('t3');zlabel('t2')
%draw the closed area on the "floor"
M=[ 5.3345 6.5203
5.3422 6.5532
5.3554 6.5840
5.3737 6.6113
5.3963 6.6343
5.4223 6.6518
5.4508 6.6633
5.4805 6.6683
5.5103 6.6665
5.5390 6.6581
5.5655 6.6433
5.5886 6.6229
5.6075 6.5975
5.6214 6.5682
5.6298 6.5362
5.6323 6.5027
5.6289 6.4691
5.6196 6.4367
5.6048 6.4068
5.5852 6.3806
5.5615 6.3592
5.5346 6.3434
5.5056 6.3337
5.4758 6.3307
5.4462 6.3345
5.4180 6.3448
5.3924 6.3613
5.3704 6.3833
5.3529 6.4099
5.3406 6.4401
5.3339 6.4727
5.3331 6.5063
5.3345 6.5203];
M=M./10;
hold on
plot((M(:,1)),(M(:,2)),'r')