How can i write this equation in matlab ??????

1 view (last 30 days)
Mary Jon
Mary Jon on 18 Sep 2013
(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 may by matrix (have i &j) w constant

Answers (2)

John Petersen
John Petersen on 18 Sep 2013
The trick is to update v(i-1,j) and v(i,j-1) without updating v(i+1,j) and v(i,j+1) before going on the v(i,j). After that do:
v(i,j)= (1-ω)*v(i,j) - ω*[(W1(i,j)*v(i+1,j) + W2(i,j)*v(i-1,j) + W3(i,j)*v(i,j+1) + W4(i,j)*v(i,j-1))/W(i,j)]
  3 Comments
Mary Jon
Mary Jon on 21 Sep 2013
I do conv2(), and imfilter() ,but no result getting yet ,where is wrong?

Sign in to comment.


Image Analyst
Image Analyst on 18 Sep 2013
Edited: Image Analyst on 18 Sep 2013
Looks like unsharp masking, so you can do this
kernel = [0, W1, 0; W3, 0, W4; 0, W2, 0];
filtered = conv2(vk, kernel, 'same');
vk = (1-omega)*vk + filtered./W;
  8 Comments
Mary Jon
Mary Jon on 20 Sep 2013
when using this "trick"
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);
get this error
Undefined function or variable "vk".
Error in ==> SOR at 69 filtered = conv2(vk, kernel, 'same');

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!