Reputation: 45
I'd like to exclusively apply a white noise signal to a PID model in matlab. I know how to both generate this signal and how to add white noise to the other signals, but I have no idea how to apply only the white noise.
I tried to use lsim
function but this one needs signals in time domain and in my white noise signal I have only values and samples. Below is how I created white noise (X
):
L=100000; %Sample length for the random signal
mu=0;
sigma=2;
X=sigma*randn(L,1)+mu;
Upvotes: 1
Views: 761
Reputation: 11064
The solution depends on where you want to add the noise:
Noise on the input
lsim(sys, u+X, t);
Noise on the output
Y = lsim(sys, u, t) + X;
Additive process noise: in this case you need to use sim
, which is an extension of lsim
Useful links:
Upvotes: 2