how can I stop this error?

this is code of my equation getting from you.
Z = zeros(size(W1)); kernel = [Z, W1, Z; W3, Z, W4; Z, W2, Z]; filtered = conv2(vk, kernel, 'same'); vk = (1-w)*vk + filtered./W(i,j);
my equation
v(i,j))^(k+1)= (1-ω)(v(i,j))^(k)-ω[(W1(i,j)(v(i+1,j))^(k)+ W2(i,j)(v(i-1,j))^(k+1)+ W3(i,j)(v(i,j+1)^(k)+ W4(i,j)(v(i,j-1))^(k+1)(/(W i,j)]
v matrix
k iteration
W matrix
w constant
the error I have is!.
Undefined function or variable "vk".
Error in ==> SOR at 69 filtered = conv2(vk, kernel, 'same');

5 commentaires

Exactly what the error is saying: you haven't defined "vk" prior to this line:
filtered = conv2(vk, kernel, 'same');
Mary Jon
Mary Jon le 1 Oct 2013
Undefined function or variable "vk".
Error in ==> SOR at 69 filtered = conv2(vk, kernel, 'same');
Walter Roberson
Walter Roberson le 1 Oct 2013
Yes. You have not set "vk" to anything by the time that line is executed. You do not assign anything to "vk" until the next expression.
Mary Jon
Mary Jon le 1 Oct 2013
Sorry ,but what I do to 'vk'? how make it defined ?
Image Analyst
Image Analyst le 1 Oct 2013
vk is presumably your original signal. If you don't know what it is, then what do you think you're filtering? Why are you attempting to filter something but don't know what it is? If you're running a filter, you must have some idea of what you want to filter, otherwise, why bother?

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 2 Oct 2013

1 vote

Initialize with k = 0 and vk = your original signal.

2 commentaires

Mary Jon
Mary Jon le 2 Oct 2013
I know 'vk' my original initial condition ,I defined 'v' as a matrix n*m
Walter Roberson
Walter Roberson le 2 Oct 2013
Initialize vk = v.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by