help in doing forward and backward difference...
1 次查看(过去 30 天)
显示 更早的评论
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???
0 个评论
采纳的回答
KSSV
2016-9-2
You must use
j = 1:length(crank_angle)-1
rather then
j = 1:1:length(crank_angle-1)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!