Integral of a function with time variables.
Ältere Kommentare anzeigen
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?
Antworten (1)
Andrew Newell
am 15 Mai 2011
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.
Kategorien
Mehr zu Functional Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!