Professor Diomar Cesar Lobao

Universidade Federal Fluminense-Volta Redonda, RJ, Brasil

Diomar Cesar


Dept. Ciências Exatas - Exact Science Dept.

Search

Implicit Function matlab script by Dio

%==========================================================================
%
%
% Examples of Implicit Function
%
% Implemented by Prof. Diomar Cesar Lobao
% UFF-Volta Redonda, RJ, Brazil.
% Sept 09th, 2008.
%==========================================================================
%
clear all; clc; close all;
%
x=-1:.1:2;
y=-2:.1:2;
[x,y]=meshgrid(x,y);
% 2y3 + y2 ? y5 = x4 ? 2x3 + x2. ==> F(x,y)=0
F=2*y.^3+y.^2-y.^5-x.^4+2*x.^3-x.^2;
%
figure(1);
surfc(x,y,F);
%
figure(2);
%contour(x,y,z,[0,0]): plots an implicit function of one variable: 
% z = F(x,y) = 0
%====> This graph is clearly not the graph of a function.
%====> There are at least two y values for each x value.
[c,h]=contour(x,y,F,[0,0],'k'); clabel(c,h); colorbar;
%
figure(3);
[c,h]=contour(x,y,F,10); clabel(c,h); colorbar;
%
%
x=-2:.1:2;
y=-2:.1:2;
[x,y]=meshgrid(x,y);
F=x.^2.*y.^2+y.^2.*cos(x)-3;
%
figure(4);
surfc(x,y,F);
%
figure(5);
contour(x,y,F,[0,0],'k')
%
x=-3:.1:3;
y=-3:.1:3;
[x,y]=meshgrid(x,y);
G=exp(x.*y)-x.^2-y.^2;
figure(6);
surfc(x,y,G);
%
figure(7);
contour(x,y,G,[0,0],'k')
%
x=-4:.1:4;
y=-4:.1:4;
[x,y]=meshgrid(x,y);
G=x.^2 + 4*y.^2 - 52;
figure(8);
surfc(x,y,G);
figure(9);
contour(x,y,G,[0,0],'k')
%
x=-4.0:.1:4.0;
y=-4.0:.1:4.0;
[x,y]=meshgrid(x,y);
G=3*x.*y.^2 - 2*y.*x.^3 + 10;
figure(10);
surfc(x,y,G);
figure(11);
contour(x,y,G,[0,0],'k')
Skip to content