Data generation using Homogenous Poisson Point Process

조회 수: 15 (최근 30일)
Bidyarani
Bidyarani 2023년 7월 31일
답변: Hornett 2024년 9월 11일
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