How to slice through a 3d surface

2 vues (au cours des 30 derniers jours)
Konstantin
Konstantin le 10 Juin 2016
Commenté : Konstantin le 11 Juin 2016
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);

Réponses (1)

Chad Greene
Chad Greene le 11 Juin 2016
Are you looking for a slice plot?
  1 commentaire
Konstantin
Konstantin le 11 Juin 2016
I want to slice the plot that I already have along the Z axis for X*Y = 1

Connectez-vous pour commenter.

Catégories

En savoir plus sur Discrete Data Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by