# plot3 with implicit domain

1 view (last 30 days)
Niklas Kurz on 27 Apr 2021
Edited: Niklas Kurz on 2 May 2021
I'd like to plot f(u,v) = (u,v,sqrt(1-u^2-v^2)) whereas u^2+v^2 <1;
I thought of using plot3 and defining
[u,v] = deal(linspace(-2,2,200));
Thing is, I got to incorporate the implicit condition somehow. Fimplicit3 doesn't help here. I could probalby solve for one of the variables and substitute but that's getting already complex in my head. Is there a handy solution?

DGM on 27 Apr 2021
Maybe something like this?
n = 50;
u = linspace(-2,2,n);
v = linspace(-2,2,n)';
f = u.^2 - v.^2; % the function
dm = (u.^2 + v.^2)<1; % the domain mask
f(~dm) = NaN; % NaN values don't plot
mesh(u,v,f)
axis equal
colormap(1-ccmap)
title('Math Pringle')
Niklas Kurz on 29 Apr 2021
Edited: Niklas Kurz on 2 May 2021
that illustration was beautiful

### Categories

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!