MATLAB: I am getting the following error on using pcolor() fucntion:??? Error using ==> surface Value must be numeric Error in ==> pcolor at 76 hh = surface(x,​y,zeros(si​ze(c)),c,’​parent’,ca​x);

pcolor

Code is as follows:
% Defining Grid
Sx = 1; % physical size along x
Sy = 1; % physical size along y
Nx = 10; % number of cells along x
Ny = 10; % number of cells along y
% A CIRCLE
% Grid Arrays
dx = Sx/Nx;
xa = [0:Nx-1]*dx;
xa = xa - mean(xa);
dy = Sy/Ny;
ya = [0:Ny-1]*dy;
ya = ya - mean(ya);
% Create Circle
r = 0.4;
[Y,X] = meshgrid(ya,xa);
A = zeros(Nx,Ny);
A = (X.^2 + Y.^2) <= r^2;
figure();
pcolor(xa,ya,A');

Best Answer

It's trying to say that it doesn't like the type 'logical'. That's what you got when you did this:
A = (X.^2 + Y.^2) <= r^2;
Probably the simplest fix would be:
pcolor(xa,ya,double(A'))