求帮助,改程序
clear;clc;lu=0;
for l=1:1:100
L=100; % 正方形区域边长
R=10; % 圆半径
M=zeros(L); % 覆盖状态
N=0; % 统计圆的数目
ss=1; % 循环控制变量
=meshgrid(1:L);
Ar=linspace(0,pi*2,200); % 圆周角度
scale=0; % 覆盖面积比例
while lu/100=0.95
x=L*rand; % 随机位置坐标
y=L*rand; % 随机位置坐标
D=sqrt(.^2+.^2); % 计算坐标点到圆心的距离
=find(D<=R); % 检测出圆覆盖点的坐标
Ind=sub2ind(,m0,n0); % 坐标与索引转化
M(Ind)=1; % 改变覆盖状态
N=N+1; % 增加圆数目
xinde=sum(M(1:end))/L/L; % 计算覆盖比例
scale=xinde;
if scale==1
lu=lu+1;
end
end
显示 while (lu/100)=0.95
|
Error: The expression to the left of the equals sign is not a valid target for an assignment. 流汗的地方=meshgrid(1:L); 本帖最后由 qlb061 于 2012-7-21 11:05 编辑
while (lu/100)=0.95 %??????;
无效的左值,常数不可以赋值!
你应该表达的是:
while (lu/100)~=0.95 把那个while xx = yy改成while xx == yy吧,反正不能在这里用=
页:
[1]