I need to create matrix without using loops

Topic : Numerical Differentiation Using Matlab
Below is given table for the time t and its corresponding x position
Use forward and central differential scheme to compute velocity and acceleration by constructing differential matrix for the first derivative and multiplying the matrix and vectors (not allowed to use loop) as it is matrix based calculation.
Forward differential scheme is = x(i+1)-x(i) / t(i+1)-t(i)
***Expecting to use Sparse*** However open to use for other function as well
Please note end position is same as start position hence velocity should be equal for t1 and t10 (Please provide just Matlab Code for this)
Time t = 0 0.0775 0.2346 0.3015 0.3682 0.4345 0.5006 0.5665 0.6321 0.6974
X position 3.1909 3.1818 3.1547 3.1104 -0.0499 -0.0499 3.1104 3.1547 3.1818 3.1909

1 件のコメント

Prabha Bhandari
Prabha Bhandari 2021 年 10 月 10 日
編集済み: Prabha Bhandari 2021 年 10 月 10 日
I just want to know the matrix formation code for forward and central differentation for function of 2 Phi

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2021 年 10 月 10 日

0 投票

Read about the function diff, gradient.

カテゴリ

ヘルプ センター および File ExchangeNumerical Integration and Differential Equations についてさらに検索

製品

リリース

R2021a

質問済み:

2021 年 10 月 10 日

回答済み:

2021 年 10 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by