jessysmith8109 jessysmith8109
  • 23-08-2019
  • Computers and Technology
contestada

convert for loop to while loop, that is the script

z1=zeros(10);
for x=1:10
for y=1:10
z1(x,y)=x^2-3*y
end
end
z1

Respuesta :

ExieFansler ExieFansler
  • 04-09-2019

Answer:

To convert for loop to while loop we have to first declare and initialize the integers or variables that will work as an counter.

script will be

z1=zeros(10);

x=1

while x<10

y=1

while y<10

z1(x,y)=x^2-3*y

y=y+1

end

x=x+1

end

z1

Remember that we have to update the counter every time that we not need to be done for loop.

Answer Link

Otras preguntas

Which of the following is not part of an argument that unions lead to increased productivity?A.reduction in worker turnoverB.improved moraleC.employees with mor
For f (c)=2x+1 and g(x)=x^2 - 7 find (f-g)(x)
When we consider the brutality of the Rwandan genocide, it seems almost inconceivable that archeological evidence points to a few larger geographical locations
An entity with a large volume of customer remittances by mail could most likely reduce the risk of employee misappropriation of cash by usingA . a bank lockbox
What persona does Carter portray
I need help on this problem, thank you :)
If x^3 = -27, then what is x?
I need help please.
Me gusta la música flamenca. Sirve _____ escuchar. A. por B. para que C. porque D. para. The answer is D. para
En la celebración de las Navidades puertorriqueñas, los cabezudos son una tradición de España y son el elemento más importante de la fiesta. A la gente le gusta