Borrar filtros
Borrar filtros

numerical operation

1 visualización (últimos 30 días)
zozo
zozo el 24 de Jun. de 2012
Suppose I have two 3.6 and 10.75.
10.75 is not divisible by 3.6 but 10.80 is perfectly divisible (difference being 0.05).
How can I compute this difference (0.05) as my output by giving 3.6 and 10.75 as inputs?

Respuestas (1)

Image Analyst
Image Analyst el 25 de Jun. de 2012
Try this:
numerator = 10.75;
denominator = 3.6;
lowerRemainder = rem(numerator, denominator)
upperRemainder = denominator - lowerRemainder
Results in command window:
lowerRemainder =
3.55
upperRemainder =
0.0500000000000003
So, you're probably wondering why it's not exactly 0.05. If so, you need to read and understand this FAQ section: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by