advanced digital signal processing

i have been asked to generate a random process s(n)=s(n-1)-0.6s(n-2)+v(n)
where v(n) is a white noise with zero mean and varience a^2= 0.49
and for n=0:10000
i need a matlab code for that

댓글 수: 12

Image Analyst
Image Analyst 2020년 11월 29일
Who asked you to do that? A professor?
What is the value of the first s? s(1)?
The noise is white with respect to n, but is it uniform distributed, or normally distributed? That tells you whether to use rand() or randn().
Walter Roberson
Walter Roberson 2020년 11월 29일
for loop.
randn() * sqrt(0.49) for the noise
r = rand(1, 10000000) * 0.49 / 0.2887; % Uniform distribution
sUniform = std(r) % Will be 0.49
r = randn(1, 10000000) * 0.49; % Normal distribution
sNormal = std(r) % Will also be 0.49
Snds Audah
Snds Audah 2020년 11월 29일
i forgut t mention that the value of s(-1)=0and s(-2)=0, and i should use randn
Snds Audah
Snds Audah 2020년 11월 29일
thanks alot. but what about the whole difference equatin. i am new in matlab
Have you completed the 2 hour training yet? After that you should know how to do a simple for loop.
v = ran................
s(1) = 0;
s(2) = 0;
for n = 3 : 1000
s(n) = s(n-1) - 0.6 * s(n-2) + v(n) % Your existing formula
end
Is this homework?
Snds Audah
Snds Audah 2020년 11월 29일
Yes it is ..and also mini project ..thanks a lot dear ..hope contact you again soon😁
r = randn(1, 10000000) * 0.49; % Normal distribution
The question asks for a specific variance, and variance is the square of the standard deviation, so you need to take the square root of the variance to get the standard deviation.
r = randn(1, 10000000) * sqrt(0.49); % Normal distribution
The question asks for a specific variance, and variance is the square of the s
Snds Audah
Snds Audah 2020년 11월 30일
syms n
for n=0:10000
v=randn()*sqrt(0.49);
s(-1) = 0;
s(-2) = 0;
s(n) = s(n-1) - 0.6 * s(n-2) + v(n);
end
can not generate it,look like something wrong
Walter Roberson
Walter Roberson 2020년 11월 30일
It is never possible to use a symbolic variable as a subscript.
It is never possible to use a negative number as a subscript.
Snds Audah
Snds Audah 2020년 12월 2일
Would you please fix it to me .because I spend time without any results. Thanks
Walter Roberson
Walter Roberson 2020년 12월 2일
The code is 6 lines. Image Analyst posted 5 of the 6 lines and I posted the exact form of the sixth https://www.mathworks.com/matlabcentral/answers/668088-advanced-digital-signal-processing#comment_1169918 except I used variable name r
You have been given all of the parts needed for the assignment, with only at most 5 characters to change.
If we were to post the complete code then you would have to ask your professor to assign you 0 for the assignment as otherwise you would be in danger of it being claimed that you might have committed academic misconduct.
Re-read what Image Analyst posted.

댓글을 달려면 로그인하십시오.

답변 (0개)

질문:

2020년 11월 29일

댓글:

2020년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by