help in doing forward and backward difference...

1 回表示 (過去 30 日間)
sri satya ravi
sri satya ravi 2016 年 9 月 2 日
回答済み: KSSV 2016 年 9 月 2 日
dv_dteta = zeros (length(crank_angle),1)
for j = 1:1:length(crank_angle-1) dv_dteta = (s(j+1)-s(j))./(crank_angle(j+1)-crank_angle(j)); end
when i write this i get an error code saying Index exceeds matrix dimensions.
the crank angle is a array of 300 data points.
is there a way to do a backward difference for the first point and the rest forward difference to match the dimensions???

採用された回答

KSSV
KSSV 2016 年 9 月 2 日
You must use
j = 1:length(crank_angle)-1
rather then
j = 1:1:length(crank_angle-1)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by