What does this code mean? wK = w0(:);
wk = w0(:);
y = zeros(N,1);
e = zeros(N,1);
W = wk;
for i = 1:N,
uvi = [u(i+1) u(i)]';
y(i) = wk'*uvi;
e(i) = d(i) - y(i);
w_new = wk + (mu*e(i))*uvi;
wk = w_new;
W = [W wk];

답변 (1개)

madhan ravi
madhan ravi 2019년 3월 26일

0 개 추천

https://in.mathworks.com/help/matlab/ref/colon.html - (:) forces a matrix or a row vector as a column vector

댓글 수: 5

madhan ravi
madhan ravi 2019년 3월 26일
Examples:
>> A
A =
1 2 3
4 5 6
7 8 9
>> A(:)
ans =
1
4
7
2
5
8
3
6
9
>> B = 1:9
B =
1 2 3 4 5 6 7 8 9
>> B(:)
ans =
1
2
3
4
5
6
7
8
9
>>
Hojin Lim
Hojin Lim 2019년 3월 26일
Thank you for answering my question.
The reason I ask is that 'wk = w0(:);' gives me an error.
'wk = wk(:);' will work?
madhan ravi
madhan ravi 2019년 3월 26일
편집: madhan ravi 2019년 3월 26일
First of all you you didn't provide any values to us so your question is vague.
"gives me an error."
Post the complete error message, everything in red.
Hojin Lim
Hojin Lim 2019년 3월 26일
편집: madhan ravi 2019년 3월 26일
>> N = 4096;
Sig1 = 0.27;
Sig2 = 0.1;
randn('state',1);
v1 = randn(N,1);
m = mean(v1);
v1 = v1 - m;
s = sum(v1.^2)/N;
v1 = sqrt(Sig1/s)*v1;
randn('state',7);
v2 = randn(N,1);
m = mean(v2);
v2 = v2 - m;
s = sum(v2.^2)/N;
v2 = sqrt(Sig2/s)*v2;
d = zeros(N+1,1);
x = zeros(N+2,1);
for i = 1:N;
d(i+1) = -0.8458*d(i) + v1(i);
x(i+2) = 0.1*x(i+1) + 0.8*x(i) + v1(i);
end
d = d(2:(N+1));
x = x(3:(N+2));
u = x + v2;
u = [0; u];
>> wk = w0(:);
Undefined function or variable 'w0'.
madhan ravi
madhan ravi 2019년 3월 26일
w0 is not defined!

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

카테고리

도움말 센터File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

질문:

2019년 3월 26일

편집:

2019년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by