Data generation using Homogenous Poisson Point Process

15 次查看(过去 30 天)
How to generate location (x, y) of 100 nodes within a radius of 1 kilometer using Homogenous Poisson Point Process with spatial density?

回答(1 个)

Hornett
Hornett 2024-9-11
To generate the locations (x, y) of 100 nodes within a radius of 1 kilometer using a Homogeneous Poisson Point Process (HPPP) with a given spatial density, you can follow these steps:
  1. Calculate the area of the circle: The area (A) of a circle with radius (r) is given by (A = \pi r^2).
  2. Determine the spatial density: The spatial density (\lambda) is the number of points per unit area. Given the number of nodes (N) and the area (A), you can calculate (\lambda) as (\lambda = \frac{N}{A}).
  3. Generate the points: Use the spatial density (\lambda) to generate the points within the circle.
Here is a MATLAB script to achieve this:
% Parameters
radius = 1; % Radius in kilometers
numNodes = 100; % Number of nodes
area = pi * radius^2; % Area of the circle
lambda = numNodes / area; % Spatial density
% Generate points using the Homogeneous Poisson Point Process
theta = 2 * pi * rand(numNodes, 1); % Random angles
r = radius * sqrt(rand(numNodes, 1)); % Random radii
% Convert polar coordinates to Cartesian coordinates
x = r .* cos(theta);
y = r .* sin(theta);
% Plot the points
figure;
scatter(x, y, 'filled');
hold on;
viscircles([0, 0], radius, 'LineStyle', '--'); % Draw the circle boundary
axis equal;
title('HPPP Generated Nodes within 1 km Radius');
xlabel('X (km)');
ylabel('Y (km)');
grid on;
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by