My piecewise function becomes NaN
古いコメントを表示
In the function below my integral becomes -inf when b is nonzero.
I think because of that my ans yields NaN instead of 2. How do I solve this problem?
Nz2=@(a,b) ((b==0)*integral(myfun,itta,inf)+(a>0 & b>0)*2)
Ans=Nz2(a,b)
4 件のコメント
R.G.
2019 年 8 月 31 日
Hello. As I can see you want to evalute integral numerically with integrand function myfunc(arg) and limits [itta, inf], where itta - is some variable and inf - means infinity. If so, it's not correct because numerical integration implies finite number of operations (in your case matlab must show warning message: 'Reached the limit...').
Could you provide more information about the task?
Shailee Yagnik
2019 年 9 月 1 日
Adam Danz
2019 年 9 月 1 日
See walter's answer to understand why you're getting a NaN and see his comment(s) under his answer.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Performance and Memory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!