matlab一段程序求解

2024-12-12 22:13:25
推荐回答(1个)
回答1:

clc,clear all

N=200; %赋初值

 x=-N/2:1:N/2;

 y=-N/2:1:N/2;

 [xx,yy] = meshgrid(x,y);   %在xy平面内划分矩阵网格

 phi0=zeros(size(xx));   %给phi0预分配空间

 ind = find(xx.^2 + yy.^2 <= 20^2 ); %寻找xy平面内寻找满足‘xx.^2 + yy.^2 <= 20^2’

 %表达式坐标的返回值

phi0(ind)=1; %把上面圆形区域的返回值对应的坐标赋值为1

     

mesh(phi0) %你可以通过这个图像清楚地知道