Info

此问题已关闭。 请重新打开它进行编辑或回答。

please, how ( index logical work in matlab ) ?

1 次查看(过去 30 天)
Dodo
Dodo 2020-10-25
关闭: MATLAB Answer Bot 2021-8-20
in solvig for example question for f2 (x) function in the range of [-2,5] and so on.

回答(1 个)

drummer
drummer 2020-10-25
编辑:drummer 2020-10-25
MATLAB does not accept negative indexes if you want to walk through your range. It also starts @ 1.
One workaround you can should be:
idx = -3;
for i = 1 : 7
idx = idx + 1
% then you apply your idx into your f2(idx) down here.
end
Cheers

Community Treasure Hunt

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

Start Hunting!

Translated by