Dot Operations in MATLAB

format compact;
%
t = 0: 0.1: 2.0; % time in seconds
m = 0.709; % Mass of capsule in Kilograms
F = 62.9 - 60; % Force in Newtons
v0 = 0; % Initial velocity is zero
%
acc = F./m % Acceleration in meters/second
x = t.*v0 + acc.*t.^2 % Position in meters
%
v = v0 + t.*acc; % Velocity in meters/second
%
a = 2.*(v.*t - x)/t.^2 % Acceleration in meters/square second
%
Table = [t', x', v', a'];
fprintf ('\n');
disp (' Time,s Position,m Velocity,m/s Acceleration,m/s2');
fprintf ('%9.2f s%10.2f m%10.2f m/s%15.3e m/s2 \n', Table')
why calculation for a is wrong?

 Accepted Answer

a = 2.*(v.*t - x)./t.^2
% ^---- missed it

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 27 Feb 2019

Commented:

on 27 Feb 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!