Create a variable to store the gravity of Earth g98ms2 A var

Create a variable to store the gravity of Earth (g=9.8m/s^2). A variable can store only the value, but not the unit. We, as programmers, need to know the units and do conversions properly when needed. What is the command to store the value, 9.8, in the variable g?

Solution

In MATLAB..,

g=9.8;

Here we are chosing g as variable and we want to assign a constant of 9.8., to that variable.,

It is easy to express that condition by using MATLAB

I .e .,

By the instruction

g=9.8;

Finally place a semicolon

Create a variable to store the gravity of Earth (g=9.8m/s^2). A variable can store only the value, but not the unit. We, as programmers, need to know the units

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site