Revision [11011]

This is an old revision of OctaveIntegerArithmetic made by ToBo on 2010-07-24 19:25:39.

 

Integer-Arithmetik unter Octave and MATLAB


Create a matrix containing Integer-Objects:
A = int8(randn(4,4)*10)


A*3implemented
A.*Aimplemented
A*Anot implemented

Keine Möglichkeit die Eigenschaften von Rechenoperartionen einzustellen (z.B. Wahl zwischen Sättigung oder Überlauf bei Addition und Multiplikation)


Beispiel mit 16-Bit-Signed-Integer:

>> a = int16(400)

a =
	400

>> b = int16(1000)

b =
   1000

>> a*b

ans =
  32767





Beispiel mit 8-Bit-Unsigned-Integer:
a = uint8(0); for i=1:10; a=a+50; disp(a); end


Ausgabe:
50
100
150
200
250
255
255
255
255
255



Minimum und Maximum eines Integer-Wertes ermitteln.

Maximum
intmax('int8')

ans = 
  127


Minimum
intmin('int8')

ans = 
  -128 




Siehe auch
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki