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

Using a consistent color scheme on each slide will make your presentation more effective. True False
Given that (9,-8) is on the graph of f(x), find the corresponding point for the function f(3/4x)
What is the full form of the acronym WWW? A. World Wide Web B. Wide World Web C. Wide Web World D. Web World Wide
Question 4(Multiple Choice Worth 2 points) (09.06) For two functions, m(x) and p(x), a statement is made that m(x) = p(x) at x = 7. What is definitely true abou
Please Answer Snip-it Below Thanks
In an experiment to determine the acceleration due to gravity, one student holds a pencil at arm’s length and drops it. Another student starts a timer when the
the basics of slider care
Question 14: The sentence provided may Contain a grammar or usage error. Read the sentence, and then identify its error, if there is one, by choosing the approp
Match the equations of ellipses to their equivalent equations in standard form.
A quadrilateral has two right angles. The measure of the third angle is 99°. What is the measure of the fourth angle?