Matlab中簇随时间的运动

Matlab中簇随时间的运动,matlab,cluster-computing,Matlab,Cluster Computing,我正在用运动编码集群。每个集群包含固定数量的节点。 我希望集群与节点一起移动。我应该怎么做在Matlab 这是我的密码: clc; clear all; close all; simulations = 10; plots_clustered = 1; % do you want to see the plots for the clustered process? side = 1000; % side of simulation area area = 4

我正在用运动编码集群。每个集群包含固定数量的节点。 我希望集群与节点一起移动。我应该怎么做在Matlab

这是我的密码:

clc; clear all; close all;

simulations = 10;
plots_clustered = 1;  % do you want to see the plots for the clustered process?

side = 1000;                % side of simulation area
area = 4*side^2;            % simulation area
o = 5;   % try 1,2,5,10     % average active nodes per cluster
r_c = 100;               % cluster radius
lambda_n = o/pi/(r_c^2)/10; % density of active nodes
lambda_h = lambda_n/o;   % density of the cluster heads

    clc
    %sim

    %% CLUSTERED PROCESS

    % Generate cluster heads locations
    % generate PPP of users
    number_h = poissrnd(lambda_h*area);
    loc_h = random('unif',-side,side,number_h,1) + ...
                                               1i*random('unif',-side,side,number_h,1);

    % Generate nodes inside clusters
    number_n = zeros(1,number_h); % number of nodes in each cluster
    loc_n = zeros(number_h,o);  % contains location of nodes
    h_n = zeros(number_h,o);  % contains fading coefficient of nodes

    for index_h=1:number_h

        number_n(1,index_h) = o; % fixed number of nodes per cluster
        %number_n(1,index_h) =  poissrnd(lambda_n*pi*r_c^2); % random number of 
                                                             % nodes per cluster

        for index_n=1:number_n(1,index_h)
            theta_n = rand*(2*pi);
            r_n = sqrt(rand)*r_c;
            loc_n(index_h,index_n) = loc_h(index_h) + r_n*cos(theta_n) + ...
                                                                1i * r_n*sin(theta_n);
            h_n(index_h,index_n) = 1/2*randn^2 + 1/2*randn^2;
        end

        if plots_clustered
            figure(1);plot(real(loc_n(index_h,1:number_n(index_h))),...
                                imag(loc_n(index_h,1:number_n(index_h))),'.'); hold on;
            figure(1),plot(real(loc_h(index_h)),...
                                 imag(loc_h(index_h)),'xr'); hold on; grid on;
        end
    end