What does it mean to Initialize variables?
이전 댓글 표시
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
답변 (2개)
Walter Roberson
2015년 10월 1일
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
2015년 10월 1일
0 개 추천
Initialised variables are the values of the variables at the beginning of the simulation, and the values of the constants in it.
카테고리
도움말 센터 및 File Exchange에서 Geometric Geodesy에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!