Home > eeg > egis > spline > polgrid.m

# polgrid

## PURPOSE

[xs,ys,zs] = polgrid(ns,ruu);

## SYNOPSIS

function [xs,ys,zs] = polgrid(ns,ruu);

## DESCRIPTION

`[xs,ys,zs] = polgrid(ns,ruu);`

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

## SOURCE CODE

```0001 function [xs,ys,zs] = polgrid(ns,ruu);
0002 %[xs,ys,zs] = polgrid(ns,ruu);
0003 %
0004 %
0005
0006
0007 xs = zeros(ns,ns);
0008 ys = zeros(ns,ns);
0009 zs = zeros(ns,ns);
0010
0011 for j = 1:ns
0012     xx = (j-(ns+1)/2)*240/(ns+1);
0013     for jj = 1:ns
0014         yy = (jj-(ns+1)/2)*240/(ns+1);
0015         th = sqrt(xx.^2+yy.^2)*pi/180;
0016         if xx == 0
0017             if yy >= 0
0018                 phi = pi/2;
0019             elseif yy < 0
0020                 phi = -pi/2;
0021             else
0022                 phi = 0;
0023             end;
0024         else
0025             phi = -atan(-yy/xx);
0026             if (yy <= 0 & xx <=0)
0027                 phi = phi - pi;
0028             end;
0029             if (yy >= 0 & xx <= 0)
0030                 phi = phi+pi;
0031             end;
0032             if (yy == 0 & xx >= 0)
0033                 phi = 0;
0034             end;
0035             if (yy == 0 & xx <= 0)
0036                 phi = pi;
0037             end;
0038         end;
0039         xs(j,jj) = ruu*sin(th)*cos(phi);
0040         ys(j,jj) = ruu*sin(th)*sin(phi);
0041         zs(j,jj) = ruu*cos(th);
0042     end;
0043 end;
0044
0045
0046
0047```

Generated on Wed 20-Mar-2019 04:00:51 by m2html © 2003