plot3 with implicit domain

1 view (last 30 days)
Niklas Kurz
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?

Accepted Answer

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
axis equal
title('Math Pringle')
Niklas Kurz
Niklas Kurz on 29 Apr 2021
Edited: Niklas Kurz on 2 May 2021
that illustration was beautiful

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!