Int returns Int when decimals input

1 回表示 (過去 30 日間)
Leon Lazzerini
Leon Lazzerini 2020 年 7 月 28 日
コメント済み: Leon Lazzerini 2020 年 7 月 29 日
Hey guys! I've done this simple function:
function [CCp] = IntCCpfunction (wi,wr,vr,vi,k,c)
syms w
l = (vr-vi)/vi;
p = w/wr;
f2 = w-wi;
fw = ((k*l*vi)/c)*(((1+p*l)*vi)/c)^(k-1)*exp(-((1+p*l)*vi)/c)^k ;
fp = (f2*fw);
CCp = int(fp,w);
end
The problem is, when i use k or c as decimals ( 2.1, 10.2 etc) the function doesn't calculate the integral. Maybe somebody could help me undestand the problem?
*Note: With ''normal'' values or decimals (wi,wr,vr,vi) it's working, so i imagine the problem has to do with the exp.

採用された回答

John D'Errico
John D'Errico 2020 年 7 月 28 日
fw = ((k*l*vi)/c)*(((1+p*l)*vi)/c)^(k-1)*exp(-((1+p*l)*vi)/c)^k ;
When k is some non-integer value, you are raising some non-trivial stuff to non-integer powers. Then you want to integrate it?
It won't happen. That is, you won't find an analytical result. When int just returns the integral form, this tells you there is no such solution.
If all of the other parameters also have numerical values, you can always use integral instead.
  1 件のコメント
Leon Lazzerini
Leon Lazzerini 2020 年 7 月 29 日
Ohh i see, that's unfortunate. The problem with integral is that i can't use the limits, i need the answer with the w to get a cost function to posteriorly derivate it.
Thanks a lot for your answer, i really couldn't understand the problem.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by