Clear Filters
Clear Filters

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);

5 views (last 30 days)
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');

Accepted Answer

Mike Garrity
Mike Garrity on 10 Mar 2016
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'))

More Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!