フィルターのクリア

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

4 ビュー (過去 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 Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by