matlab利用nan命令去除区域
区域如下:x=-0.5:0.5:37.5;y=-75.5:0.5:75.5;想要将x=6.5:16;y=56:58;这部分区域设置成nan怎么做...
区域如下:
x=-0.5:0.5:37.5;
y=-75.5:0.5:75.5;
想要将
x=6.5:16;
y=56:58;
这部分区域设置成nan怎么做 展开
x=-0.5:0.5:37.5;
y=-75.5:0.5:75.5;
想要将
x=6.5:16;
y=56:58;
这部分区域设置成nan怎么做 展开
2个回答
展开全部
x(x<=16&x>6.5) = NaN;
y(y<=58&y>56) = NaN;
追问
我想的是在大矩形中剔除一个小矩形
x=-0.5:0.5:37.5;
y=-75.5:0.5:75.5;
x(x6.5) = NaN;
y(y56) = NaN;
[u,v]=meshgrid(x,y);
n=302;m=76;
T=zeros(n+1,m+1);
surf(x,y,T);
view(2);
这样一写只能剔除一个十字
追答
x=-0.5:0.5:37.5;
y=-75.5:0.5:75.5;
[u,v]=meshgrid(x,y);
idx = u<=16&u>6.5&v<=58&v>56;
u(idx) = NaN;
v(idx) = NaN;
n=302;m=76;
T=zeros(n+1,m+1);
surf(u,v,T);
view(2);
展开全部
clear all;
clc;
x=-0.5:0.5:37.5;
y=-75.5:0.5:75.5;
xa = find(x==6.5);
xe = find(x==16);
ya = find(y==56);
ye = find(y==58);
for i = xa:xe
x(i) = NaN;
end
for i = ya:ye
y(i) = NaN;
end
clc;
x=-0.5:0.5:37.5;
y=-75.5:0.5:75.5;
xa = find(x==6.5);
xe = find(x==16);
ya = find(y==56);
ye = find(y==58);
for i = xa:xe
x(i) = NaN;
end
for i = ya:ye
y(i) = NaN;
end
追问
我想去除的是一块方块区域
追答
这不就是方块区域么?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询