How to Cut a 3D plane with a line?
32 views (last 30 days)
Show older comments
Mahmoud Shakouri on 20 Apr 2016
I am plotting a joint pdf of some random variables and need to cut this surface with a plane extruded from a line on the XY space. The final figure should be something similar to the attached photo. I was able to plot everything except for the cutting part. Can anyone help me?
mu = [0 0];
Sigma = [.4 .4; .4 1.5];
x1 = -2.5:.2:2.5;
x2 = -2.5:.2:2.5;
[X1,X2] = meshgrid(x1,x2);
F = mvnpdf([X1(:) X2(:)],mu,Sigma);
F = reshape(F,length(x2),length(x1));
axis([-3 3 -3 3 0 .4])
xlabel('x1'); ylabel('x2'); zlabel('Joint Probability Density');
z = zeros(26);
y = exp(x1);
I want it to be like this
Arnab Sen on 27 Apr 2016
You can set the value of the F matrix to 0 for the specific region before plotting. You may consider the following code snippet for illustrative purpose:
y = exp(x1);
So, for that specific region the height is zero that should be reflected in plot. If you have follow up questions related to this you may consider contacting MathWorks Tech support of your region and one of the engineer will assist you.
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!