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!