Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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');

Akzeptierte Antwort

Mike Garrity
Mike Garrity am 10 Mär. 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'))

Weitere Antworten (0)

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by