matlab - Displaying surface with non-rectangular boundary -


refer attached image. want display image in matlab using function surf(). however, want display region of actual object without background (the pale-green region surrounding actual object has 0 value). how that? tried replacing outer region 0 nan , setting values in height map nonzero value, still error message:

subscript indices must either real positive integers or logicals. 

so how can display surface has non-rectangular boundary?

enter image description here

setting values nan should do. here's example:

[x, y] = ndgrid(linspace(-1,1,500)); z = cos(2*pi*(x+y)*2); z(x.^2+y.^2>1) = nan; %// remove values outside unit circle surf(x,y,z,'edgecolor','none') colorbar view(2) axis equal 

enter image description here


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -