Difference between two iteration of for loop

Hi I need to have difference between to successive iteration of for loop. As example:
For i=1:n P(i)=statement; end
How can I calculate: DeltaP=P(i)-P(i-1)??!! THANKS

 採用された回答

Adam
Adam 2018 年 6 月 12 日

0 投票

diff( P )
after the for loop should do this for you for all pairs of consecutive elements of P

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

質問済み:

2018 年 6 月 12 日

コメント済み:

2018 年 6 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by