Calculate total flow from flow rate

9 ビュー (過去 30 日間)
JE
JE 2016 年 12 月 19 日
コメント済み: dpb 2016 年 12 月 19 日
I am looking to calculate the total flow from a mass flow rate - or simply integrate mass flow rate. I am new to matlab so I am wondering if there is a function to do this or if I will need to write my own function to complete this. I can do this easily in excel (multiply flow rate by sample time, sum results), but am not sure how to do this in matlab. I have tried to use the 'trapz' function, but because my flow goes slightly negative at times, this function does not seem to be working. Can any one point me in the right direction?
  1 件のコメント
dpb
dpb 2016 年 12 月 19 日
What makes you think trapz isn't working? Certainly it's simple enough to do a cumulative summation approximation directly as well...
fl=dt*cumsum(f);
if dt is constant, otherwise
fl=cumsum(f.*dt);
Not as an accurate an approximation as a trapezoidal approx, though...

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by