Array indices must be positive integers or logical values.

Hi, I am new at Matlab. How do I do the integration of V=0.001 from 0 to 200 seconds (x)?
This is my try, but I always get the "Array indices must be positive integers or logical values"-error.
Can somebody help me please? Thanks in advance.
function y=Volumen(x)
global V
V=0.001
f = @(x) V(x);
q = integral(@(x) V(x),0,200)

1 件のコメント

Asmit Singh
Asmit Singh 2021 年 5 月 27 日
It is not clear as to what function you are trying to integrate. Please mention the exact function and the range of integration.

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

回答 (1 件)

Jan
Jan 2021 年 5 月 27 日
編集済み: Jan 2021 年 5 月 27 日

0 投票

Your V is constant. Then the integral is:
function y = Volumen(x)
V = 0.001;
y = V * 200;
end
But this does not depend on x. So please explain, which problem the code should solve.

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

質問済み:

2021 年 5 月 27 日

編集済み:

Jan
2021 年 5 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by