Clear Filters
Clear Filters

How to add white noise to ARX model

3 views (last 30 days)
Tarek Hajj Shehadi
Tarek Hajj Shehadi on 27 Mar 2022
Answered: vidyesh on 1 Dec 2023
Consider the linear difference model of the form: y[n]-0.8y[n-1] =x[n-1]+w[n]
both x[n] and w[n] are zero mean white noise with unity variance,
To find y I would usually do:
n=300;
x=rand(n,1);
b=[0 1];
a=[1 -0.8];
y=filter(b,a,x);
what this solves is y[n]-0.8y[n-1]=x[n-1]
My question is how do I include the additive term w[n], In this special case I could have said w=x; and b=[1 1] but what about general case if x[n] was not white but was a different type of input like a step input and w[n] was white how do I then solve this linear difference equation.

Answers (1)

vidyesh
vidyesh on 1 Dec 2023
Hi Tarek,
I understand that you want to add white noise to your model.
The ‘awgn’ function in the Communications Toolbox can be used to add White Gaussian Noise to the signal. A parameter ‘snr’ is passed with the signal, and it is used to decide the relative power of the noise with respect to your signal. Unit of ‘snr’ is decibel.
Add the below line in your code before you calculate ‘y’ to add noise to ‘x’.
x_noisy = awgn(x, snr, measured);
Another choice is to generate noise samples usingwgn’ function and adding to ‘x.
Refer the below documentation for details on the ‘awgn’ and ‘wgn’ functions:
Hope this answer helps.

Community Treasure Hunt

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

Start Hunting!