function to generate aircraft position data
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to implement Kalman Filter for aircraft radar tracking. I need data on aircraft position in two dimensions and velocity (given a constant acceleration). Which functions should I use to generate this data randomly given the needed properties?
0 comentarios
Respuestas (1)
Shaunak
el 25 de Abr. de 2025
Hi Sofiya,
To generate synthetic aircraft position and velocity data in two dimensions with constant acceleration for testing a Kalman Filter, you can use MATLAB’s random number functions to define initial conditions and simulate measurement noise. This approach will let you create realistic position and velocity data for your filter.
Here is an example of how you can randomly generate data for testing a Kalman Filter:
clc; clear; close all
% Simulation parameters
N = 100; % Number of time steps
dt = 1; % Time interval (seconds)
t = (0:N-1)*dt; % Time vector
% Random initial conditions
x0 = 1000*rand; % Initial x position (meters)
y0 = 1000*rand; % Initial y position (meters)
vx0 = 50 + 10*randn; % Initial x velocity (m/s)
vy0 = 50 + 10*randn; % Initial y velocity (m/s)
ax = 0.5*randn; % Constant x acceleration (m/s^2)
ay = 0.5*randn; % Constant y acceleration (m/s^2)
% True positions and velocities
x_true = x0 + vx0*t + 0.5*ax*t.^2;
y_true = y0 + vy0*t + 0.5*ay*t.^2;
vx_true = vx0 + ax*t;
vy_true = vy0 + ay*t;
% Simulate radar measurements (add Gaussian noise)
position_noise_std = 20; % Standard deviation of measurement noise (meters)
x_meas = x_true + position_noise_std*randn(1, N);
y_meas = y_true + position_noise_std*randn(1, N);
% Combine into measurement matrix
measurements = [x_meas; y_meas];
% Plot for visualization
figure;
plot(x_true, y_true, 'b-', 'LineWidth', 2); hold on;
plot(x_meas, y_meas, 'ro');
legend('True trajectory', 'Measured positions');
xlabel('X Position (m)');
ylabel('Y Position (m)');
title('Aircraft Trajectory and Simulated Radar Measurements');
grid on;
Now, the `measurements` variable as the input for your Kalman Filter.
For more details on random number generation in MATLAB, you can refer to the documentation:
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Communications Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!