필터 지우기
필터 지우기

Create Gaussian noise with given PSD

조회 수: 67 (최근 30일)
Gianmarco Broilo
Gianmarco Broilo 2022년 2월 25일
답변: Yash Sharma 2023년 9월 27일
Hello community, I have the PSD of a noise from an IMU that is 10e-12 from this value of the PSD I wanted to create a gaussian noise of 1e6 samples. Now I want to compare this noise with the noise of an accelerometer that has the PSD like this: 10e-14 + 10e-18*f^-2 with f going from 10e-5 to 10 Hz. How could I implement that? Thank you a lot!
This is what I have:
PSD = 10e-12;
sigma2 = PSD/dt;
x = randn(N,1)*sqrt(sigma2);

답변 (1개)

Yash Sharma
Yash Sharma 2023년 9월 27일
Hi,
I understand that you want to create Gaussian noise with the given PSD value and compare that with the noise of an accelerometer.
To create Gaussian noise with a specified Power Spectral Density (PSD) and compare it with accelerometer noise, you can use the randn function in MATLAB to generate Gaussian random numbers. Additionally, you can use the logspace function to generate a frequency range in logarithmic scale.
Here is an example implementation in MATLAB:
PSD = 10e-12;
num_samples = 1e6;
% Calculate the variance based on the PSD and the sampling interval (dt)
dt = 1.0; % Assuming a sampling interval of 1 second
variance = PSD * dt;
% Generate the Gaussian noise signal
x = randn(num_samples, 1) * sqrt(variance);
% Plot the generated noise signal
figure;
plot(x);
xlabel('Sample');
ylabel('Amplitude');
title('Gaussian Noise Signal');
grid on;
f_min = 10e-5;
f_max = 10;
num_points = 1000;
% Generate the frequency range
f = logspace(log10(f_min), log10(f_max), num_points);
% Calculate the PSD based on the accelerometer's formula
PSD_acc = 10e-14 + 10e-18 ./ f.^2;
% Plot the PSD
figure;
loglog(f, PSD_acc);
xlabel('Frequency (Hz)');
ylabel('PSD');
title('Accelerometer Noise PSD');
grid on;
Your implementation might be different from the above code.
Please find the links to below documentation which I believe will help you for further reference:
Hope this helps!

카테고리

Help CenterFile Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by