Monday, August 1, 2011

Scilab example: plotting implicit curves (level curves)

In this example, we will plot the implicit curve (level curve, contour line) defined by
the equation fun(x,y) = 0.

fun(x,y) =


Scilab script:

xset("wdim",400,400);
xset("fpf"," ");
square(-2,-2,2,2);
function z = fun(x,y)
z = (x*x+y*y-3)*sqrt(x*x+y*y) + 0.75 ..
+ sin(4*sqrt(x*x+y*y))*cos(84*atan(y/x)) - cos(6*atan(y/x));
endfunction
data = linspace(-2, 2, 512);
contour2d(data, data, fun, [0,0], style=color("red"), axesflag=0);


The result plot:


More examples:

No comments:

Post a Comment