How to slice through a 3d surface
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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);
0 Commenti
Risposte (1)
Vedere anche
Categorie
Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!