Integral of a function with time variables.
古いコメントを表示
Hello,
I try to calculate the integral of the following function:
F(t) = r + Integral from 0 to 20 of (D(p)*s(t-p)dp)
I tried it the following way, but get some errors:
f = r+(eval(int(sym('D*s*(p-tau)'),0,20)));
Error: ??? Error using ==> mupadmex Error in MuPAD command: Illegal integrand [int]
Error in ==> sym.int at 56 r = mupadmex('symobj::intdef',f.s,x.s,a.s,b.s);
Does anyone have a suggestion how to implement the integral correctly?
回答 (1 件)
Andrew Newell
2011 年 5 月 15 日
You've got multiple problems here. You haven't defined which variable you are integrating over. More importantly, in your problem statement D and s are functions, but in the integral you are treating them like constants. Here is an example of how you could calculate your integral, assuming you know what D and s actually are:
syms p r tau
D = cos(p);
s = sin(p-tau);
f = f = r + int(D*s,p,0,20);
Note also that the eval was unnecessary.
カテゴリ
ヘルプ センター および File Exchange で Functional Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!