hi,
i need do make a script that will generate new vectors within a loop, so i can control the number of vectors i need.
for example i wrote a simulation for two masses and to describe the change in their velocity over time i created two vectors of v and two vectors of the change in v over time.
but now i need to write the same code for n masses and i wonder if there is a way to define the new vectors for each mass within a loop that will genarete them or i have to keep do it manually? (wich will make the code a real mess as i add more and more masses)

 採用された回答

Matt J
Matt J 2021 年 8 月 16 日
編集済み: Matt J 2021 年 8 月 16 日

0 投票

It would make more sense to store the velocities and accelerations in a single n-column matrix. This would also avoid the issues discussed here:

1 件のコメント

chen rozen
chen rozen 2021 年 8 月 16 日
thank you! it is makes more sence

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

その他の回答 (0 件)

カテゴリ

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

タグ

質問済み:

2021 年 8 月 16 日

コメント済み:

2021 年 8 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by