Search code examples
matlabsymbolic-integration

Finding unknown limit of integration in MATLAB


I have an equation of the form c = integral of f(t)dt limiting from a constant to a variable (I don't want to show the full equation because it is very long and complex). Is there any way to calculate in MATLAB what the value of that variable is (there are no other variables and the equation is too difficult to solve by hand)?


Solution

  • Assume your limit is from cons to t and g(t) as your function with variable t. Now,

    syms t
    f(t) = int(g(t),t);
    

    This will give you the indefinite integral. Now f(t) will be

    f(t) = f(t)+f(cons);
    

    You have the value of f(t)=c. So just solve the equation

    S = solve(f(t)==c,t,'Real',true);
    

    eval(S) will give the answer i think