graph - Plotting iteratively defined function in MATLAB -


i'm not matlab professional , so, need @ producing 3d plot of iteratively defined function f : r^2-0 -> r defined below (in pseudocode) x,y values in [-1,1] and

for each i = 1,2,3 , a = (0.5,0.5)

function  f(v in r^2-0) {     a=b=0;     (a,b in r)             (i=0; i<i; i=i+1)     {         v = |v| / ||v||^2 - a;         = + | ||v||-b |;         b = ||v||;     }     return a; } 

(|v| denotes component-wise vector absolute value)

(if want can @ fractal generated function @ question on math-exchange here:

https://math.stackexchange.com/questions/1457733/a-question-about-a-fractal-like-iteratively-defined-function )

matlab code appreciated.

much thanks.

save main program:

clear clc close  % = 1; % = [ 0.5 0.5 ];  = 10; = [ 0.5 0.5 0.5 ];  xmin = -1; xmax = 1;  ymin = -1; ymax = 1;  nx = 101; ny = 101;  dx = (xmax - xmin) / (nx - 1); dy = (ymax - ymin) / (ny - 1);  x = xmin: dx: xmax; y = ymin: dy: ymax;  ix = 1: nx     iy = 1: ny         if (length(a) == 2)             z(iy, ix) = f([x(ix) y(iy)], a, i);         elseif (length(a) == 3)             z(iy, ix) = f([x(ix) y(iy) 0], a, i);         end     end end  pcolor(x, y, z) shading interp 

then save function in same directory main program f.m:

function result = f(v, a, i)  = 0; b = 0;  = 1:     v = abs(v) / dot(v, v) - a;     = + abs(norm(v) - b);     b = norm(v); end result = a;  end 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -