フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Matrix Loop Code Question

2 ビュー (過去 30 日間)
Adam Francki
Adam Francki 2020 年 4 月 3 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
MATLAB Question:
im just trying to write some code to solve the following problem. if i have a matrix showing pressure losses at section intervals. Eg.
Loss= [ 2, 3, 4, 6] psi and a starting pressure of 400 psi
how would write a code that would produce a matrix showing the resultant pressure after the loss is applied:
eg. 400-2=398 psi 398-3=395 psi 395-4=391 psi 391-6=385 psi
giving a matrix: P_resultant = [398 395 391 385]
thanks!

回答 (1 件)

Birdman
Birdman 2020 年 4 月 3 日
P_resultant=cumsum([400 -Loss]);
P_resultant(1)=[]

この質問は閉じられています。

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by