What does it mean to Initialize variables?
Mostrar comentarios más antiguos
If a stationary ball is released at a height h_0 above the surface of the Earth with a vertical velocity〖 v〗_0, the position and velocity of the ball as a function of time will be given by the equations:
h(t)= 1/2 gt^2 + v_0 t + h_0
v(t)= gt + v_0
where g is the acceleration due to gravity (-9.81 m/s^2), h is the height above the surface of the Earth (assuming no air friction), and v is the vertical component of velocity. Create variables for this problem
Initialize g, v_0= 1 m/s , and h_0=2 m
Initialize t to 1 second
Respuestas (2)
Walter Roberson
el 1 de Oct. de 2015
Initialize means to assign them a value for the first time. You might change their values afterwards or you might not.
For example,
total = x;
if y > 5
total = total + y;
end
Here we could only have added y to total once we had already assigned a value to total. If the code had instead been
if y > 5
total = total + y;
end
then it would have failed because total did not exist yet.
Star Strider
el 1 de Oct. de 2015
0 votos
Initialised variables are the values of the variables at the beginning of the simulation, and the values of the constants in it.
Categorías
Más información sobre Geometric Geodesy en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!