Is there any way how to integrate a double variable

3 ビュー (過去 30 日間)
Meva
Meva 2014 年 10 月 9 日
編集済み: Meva 2014 年 10 月 10 日
Hi,
I have a script for calculating lots of variables with changing time and x_lateral position. I want to integrate one of these changing variables as related part shown below:
for i=1:ii
x=(i-1)*dx;
fikness=fik*sin(pi*x);
gap1(i)=(H1-0.5*fikness-A*(x-1/2));
end
massflux_first(i)=(int(gap1(i),x,0,1))
Inside gap1 function H1 and A varies in the whole program and x of course. so when I execute the error :
Undefined function 'int' for input arguments of type 'double'.
Error in ******* (line ***)
massflux_first(i)=(int(gap1(i),x,0,1))
When I look at workspace it says
gap1 is double.
Could anyone help me?

採用された回答

Titus Edelhofer
Titus Edelhofer 2014 年 10 月 9 日
Hi,
for a vector gap1 you can use the function trapz as a simple way of integrating...
Titus

その他の回答 (1 件)

Meva
Meva 2014 年 10 月 10 日
編集済み: Meva 2014 年 10 月 10 日
Many thanks Titus I will definitely use.

カテゴリ

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