Help!!! I keep getting error message "Array indices must be positive integers or logical values."
이전 댓글 표시
Hi this is my code for calcualting the forward difference of the following array.
t= [0 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400 420 440 460 480 500 520];
v= [0 139 298 433 685 1026 1279 1373 1490 1634 1800 1986 2191 2417 2651 2915 3303 3516 3860 4216 4630 5092 5612 6184 6760 7327 7581];
h=20;
for i = 1:length(t);
Dforward(i)= v(t(i)+h)-v(t(i))/h;
end
I believe my problem is the code keeps calcualting beyond the boundries of my array, and I'm not sure what todo to fix it. Please any advice would be great
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
