Home > Archive > Matlab > May 2005 > taking modulus
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| hello
i require to take the modulus of a particular result..
the command in the help window gives the mod of the remainder,...
example
AM = a1(1,2) / ( a1(1,1)*r)
here, a1 matrix and r are already defined.
i require the modulus of AM for further calculations..
that is.. i want to take the positive value even if the result if
negative.
plz help
| |
| Roger Stafford 2005-05-31, 4:03 am |
| In article <ef078be.-1@webx.raydaftYaTP>, neha <neha_goyal85@yahoo.co.in> wrote:
> hello
>
> i require to take the modulus of a particular result..
>
> the command in the help window gives the mod of the remainder,...
> example
> AM = a1(1,2) / ( a1(1,1)*r)
> here, a1 matrix and r are already defined.
>
> i require the modulus of AM for further calculations..
> that is.. i want to take the positive value even if the result if
> negative.
>
> plz help
-----
There is a function 'mod' which will give you a non-negative result if
your divisor is positive. That is, mod(8,5) = 3, mod(-8,5) = 2. What do
you plan to use as the divisor - is it the denominator above, a1(1,1)*r?
If so, you need that to always be positive.
(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
|
|
|
|
|