Creating a code that calculates acceleration simulation

clc
clear all
close all
x = [0, 10, 20, 30, 40, 50]; %time in minutes
y = [0, 60, 120, 280, 150, 40]; %distance travelled in x minutes

回答 (1 件)

Johannes Hougaard
Johannes Hougaard 2020 年 5 月 20 日

0 投票

x = [0, 10, 20, 30, 40, 50]; %time in minutes
y = [0, 60, 120, 280, 150, 40]; %distance travelled in x minutes
xForward = x(1:end-1); % define the domains to perform forward differences for x
yForward = y(1:end-1); % define the domains to perform forward differences for y
diffX = x(2:end) - xForward;
diffY = y(2:end) - yForward;
diff(y) %used to verify the forward difference calculated above

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

タグが未入力です。

質問済み:

2020 年 5 月 20 日

編集済み:

2020 年 5 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by