Calculate the Weight (w).
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers111
Suggested Problems
-
111 Solvers
More from this Author40
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
% Weight_of_Object.M
% This script calculates the gravitational weight of an object.
clear; % Clears old variables
clc; % Clears the command window
%% 1. Inputs
% You can change these numbers to try different setups!
mass = 10; % Mass of the object in kilograms (kg)
gravity = 9.81; % Acceleration due to gravity on Earth (m/s^2)
%% 2. Calculation
% Multiplying mass, and gravity together
W = mass * gravity;
%% 3. Display the Result
% This prints the answer in a nice, readable sentence
fprintf('The Weight of the object is %.2f Newton.\n', W);