Creating a code that calculates acceleration simulation

2 visualizaciones (últimos 30 días)
Sinclair Song
Sinclair Song el 20 de Mayo de 2020
Editada: Sinclair Song el 27 de Mayo de 2020
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

Respuestas (1)

Johannes Hougaard
Johannes Hougaard el 20 de Mayo de 2020
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

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by