[ img ] = drawImplicitFun( f,xRange,yRange,grid )
This is simple program to plot a implicit function F on IMG
F is a function handle with two variables
IMG is a binary image containing the plot of F=0.
example:
f = @(x,y)cos(x)+cos(y)-cos(x.*y);
img = drawImplicitFun(f,[-10,10],[-10,10],0.05);
figure, imshow(img)
note:
1. The program makes use of the fact that if function f is continuous in [a,b] and f(a)*f(b)<=0, then there exists a point p between [a,b] s.t. f(p)=0. So if there are singularity points, the plot may be wrong. If the zero point is not on the grid, this program may not show all the zero points, e.g. when the function value changes too fast, or the zero point is also a minimum point. But in most cases, this program is OK.
2. Sometimes the image shown by imshow containa unexpected dash lines (which should have been continuous). This may be caused by interpolation methods of imshow. Try to zoom the image.
3. If you want a plot of several implicit functions, just use the OR operator on several images.
引用格式
Ke Yan (2024). plot 2D implicit function (https://www.mathworks.com/matlabcentral/fileexchange/44260-plot-2d-implicit-function), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
- MATLAB > Graphics > 2-D and 3-D Plots > Line Plots >
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |