beam.m

来自「matlab一些非常经典算法的程序以及说明」· M 代码 · 共 29 行

M
29
字号
%function lightpoint=beam(l)
function lightpoint=beam(l)
step=0.5;
lightpoint=[];nlp=0;
z0=0;
while z0<=21.6
    x0=-sqrt(60*z0);
    while x0<=sqrt(60*z0)
        y0=sqrt(60*z0-x0^2)
        b=-l/2;
        while b<=l/2
            [x,y]=pannel(x0,y0,z0,b);
            nlp=nlp+1;
            lightpoint(nlp,1:2)=[x,y];
            b=b+step;
        end
        y0=-sqrt(60*z0-x0^2)
        b=-l/2;
        while b<=l/2
            [x,y]=pannel(x0,y0,z0,b);
            nlp=nlp+1;
            lightpoint(nlp,1:2)=[x,y];
            b=b+step;
        end
        x0=x0+step;
    end
    z0=z0+step;
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?