this is a part of my test and i cant find the mistake in this .

2 visualizaciones (últimos 30 días)
x = 1;
while (x < 10)
x = x - 1;
disp( x )
end

Respuesta aceptada

Star Strider
Star Strider el 17 de En. de 2020
The obvious observation is that ‘x’ is going to be less than 10 from the initial iteration through how many iterations it takes to be essentially equivalent to -Infinity.
  3 comentarios
mohamad abou khalil
mohamad abou khalil el 17 de En. de 2020
so what is the suggested answer to avoid this loop (x=1:1:10) ?
James Tursa
James Tursa el 17 de En. de 2020
Add 1 instead of subtract 1.

Iniciar sesión para comentar.

Más respuestas (3)

mohamad abou khalil
mohamad abou khalil el 17 de En. de 2020
oh ok thank you very much

mohamad abou khalil
mohamad abou khalil el 17 de En. de 2020
you guys have by anychance knowledge about binary systems (2 complement and negative numbers ?)
  2 comentarios
James Tursa
James Tursa el 17 de En. de 2020
Yes. Open up a new question and we can help.
Star Strider
Star Strider el 17 de En. de 2020
For my part, to an extent, although I’ve not done anything with them since graduate school (when we rode sauropods). However -Inf is still -Inf reagrdless of the base it is calcualted in. It just takes a different form.

Iniciar sesión para comentar.


mohamad abou khalil
mohamad abou khalil el 17 de En. de 2020
ok so for example the question is that in 6 bit system which calculates negative numbers , they give us the binary form for example 100000 and we should write what number it represents
  2 comentarios
John D'Errico
John D'Errico el 17 de En. de 2020
Again, stop posting new answers just to make a comment or ask a new question. Ask a new question.
mohamad abou khalil
mohamad abou khalil el 17 de En. de 2020
my question has nothing to do with matlab so im just asking these two guys , whats your problem man

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with 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