How can we fill a region defined by a implicit function?
Mostrar comentarios más antiguos
I use fimplicit(f, -10,10,-10,10) to plot the curve
where
. How can I color the region in which
from the rectangle
?
where
. How can I color the region in which
from the rectangle
?I know a solution which is not that precise:
f=@(x,y) sin(x)*sin(y)-0.5;
x=linspace(a1,b1,100);
y=linspace(a2,b2,100);
[X,Y]=meshgrid(x,y);
condition=f(X,Y)>=0;
output=zeros(Nx,Ny);
output(~(condition))=1;
imshow(output, 'xdata', x, 'ydata', y);
axis on;
I don't know why the y-axis is reversed in that situation,and it appears smaller or greater depending on the length of x and y. Moreover I don't know how to use other colors than black and white (see here https://www.mathworks.com/matlabcentral/answers/297554-how-can-i-plot-the-region-for-two-inequalities). Anyway, is there a solution which maybe use the points we get from fimplicit?
fp=fimplicit(f,-10,10,-10,10);
Points=[fp.Xdata;fp.Ydata];
Maybe using patch or fill commands...? It works fine with patch if I have a connected curve, but this is not the case.
In Wolfram Alpha I just write f(x,y)>0 and the region is ploted. I wonder if there is such a code for Matlab too.
2 comentarios
Maxim Bogdan
el 17 de Abr. de 2021
Star Strider
el 17 de Abr. de 2021
As always, my pleasure!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Surface and Mesh Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!