How to slice through a 3d surface

조회 수: 2 (최근 30일)
Konstantin
Konstantin 2016년 6월 10일
댓글: Konstantin 2016년 6월 11일
I have grid for x values: 'LTV', and for y values: 'shock'.
Then for each point of the grid calculate z values according to the 'Loss' function and plot x, y, z as a surface.
Finally I want to add a slice of that surface for values for which x*y=1 . I am able to draw this line for z = 0 by using:
plot3( repmat(LTV',1,101), 1./repmat(LTV',1,101), zeros(91,101),'LineWidth',2);
If I want to make this line a surface isn't there a way to simply tell Matlab to draw it for x*y=1 in the range z = [0 0.5] ?
LTV = 0.1:0.01:1;
shock = 1:0.01:2;
sigma = 0.174;
rd = 1.0204;
mu = 1;
G = @(LTV) (1 - normcdf((0.5*(sigma)^2 -log(LTV))/sigma, 0, 1))./LTV;
F = @(LTV) logncdf(LTV, -0.5*(sigma^2), sigma);
Ggrid = G(LTV'*ones(1,101));
Fgrid = F(LTV'*ones(1,101));
Ggrid_s = G(LTV'*shock);
Fgrid_s = F(LTV'*shock);
Loss = rd*(1 - (mu*Ggrid_s + 1 - Fgrid_s)./(mu*Ggrid + 1 - Fgrid) );
fig = figure;
surf( repmat(LTV',1,101), repmat(shock,91,1), Loss);
set(gca,'XLim',[0.1 1]);
set(gca,'YLim',[1 2]);
set(gca,'ZLim',[0 0.5]);
hold on;
plot3( repmat(LTV',1,101), 1./repmat(LTV',1,101), zeros(91,101),'LineWidth',2);

답변 (1개)

Chad Greene
Chad Greene 2016년 6월 11일
Are you looking for a slice plot?
  댓글 수: 1
Konstantin
Konstantin 2016년 6월 11일
I want to slice the plot that I already have along the Z axis for X*Y = 1

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by