Effacer les filtres
Effacer les filtres

Why the division of two positive values gives negative value?

1 vue (au cours des 30 derniers jours)
Youssra
Youssra le 5 Mai 2016
Modifié(e) : Stephen23 le 5 Mai 2016
Hello,I'm using the following code to find a positive factor:
[U S V] = svd(image, 'econ'); % calculate the SVD of the image
level=4;
factorJND=jnd(image, level) ; % calculate the JND values of the image
f=factorJND/abs(U*V) % divid the JND value by the multiplication of U and V matrices ( they have the same size)
knowing that factorJND and abs(U*V) are both positive, it gives me positive and negative numbers!! I don't know why!
f= -7.2851 6.4520
-7.7509 5.5236
-7.3374 4.1684
-5.6905 5.0915
I even try to do :
f=abs(factorJND)/abs(U*V)
But still gives me the same result while it should be all positive values!

Réponse acceptée

Stephen23
Stephen23 le 5 Mai 2016
Modifié(e) : Stephen23 le 5 Mai 2016
You are using the wrong divide: you probably intended to use array right divide ./ instead of matrix right divide / (yes, they are different, and it is your job to pick the right one).
And read about the difference:
That is why MATLAB has documentation: so that we know how to use it. You should read it whenever you use any function or operator, so that you understand how to use MATLAB. You don't need to just guess or ask random strangers on internet forums.
  1 commentaire
Youssra
Youssra le 5 Mai 2016
Oh my God I totally forgot about that :o!!it works immediatelly. thank youuu ^^

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by