- Randn: https://www.mathworks.com/help/matlab/ref/randn.html
- Logspace: https://www.mathworks.com/help/matlab/ref/logspace.html
- Loglog: https://www.mathworks.com/help/matlab/ref/loglog.html
Create Gaussian noise with given PSD
51 views (last 30 days)
Show older comments
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);
0 Comments
Answers (1)
Yash Sharma
on 27 Sep 2023
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!
0 Comments
See Also
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!