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 次查看(过去 30 天)
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');

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by