Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Numerical solution of integral equation with parametric variable

Asked by Ann

Ann (view profile)

on 7 Apr 2011
Latest activity Edited by Pooyan

Pooyan (view profile)

on 9 Jun 2014

Hello!

Please, how can I solve integral equation in Matlab

L = integral (f(b,t)) dt for third variable (parametric variable b)

Limits of integral are t0, t1.

1 Comment

bym

bym (view profile)

on 7 Apr 2011

numerically or symbolically?

Ann

Ann (view profile)

Tags

Products

No products are associated with this question.

3 Answers

Answer by Jarrod Rivituso

Jarrod Rivituso (view profile)

on 7 Apr 2011
Accepted answer

OK, I'm gonna assume you want to do it numerically. Check out this (warning, it gets a little crazy with the function handles):

function solveIntegralForB
bfound = fsolve(@func2minimize,2)
      function output = func2minimize(b)
          t0 = 0;
          t1 = 3;
          L = 50;
          output = (L - quad(@myFunc,t0,t1))^2;
          function f = myFunc(t)
              f = exp(b*t);
          end
      end
end

Essentially, what it does is use the quad function to perform an integration for some value of b. Additionally, it uses the fsolve function to then minimize the "func2minimize" function, which performs the integral for some value of b and checks it against my desired solution.

Here, I've assumed a simple function (exp(b*t)) as f, but you could see how it could be changed. Of course, this is an iterative solution, so there's no guarantee of it finding a solution for all functions f.

Hope this helps!

1 Comment

Pooyan

Pooyan (view profile)

on 9 Jun 2014

How if L is a known function of t and b is an unknown function of t? Can anyone help me on that? and again I want to solve the equation for b(t). Let's assume L(t)= sin(t) and t=0:0.1:10;

Thanks.

Jarrod Rivituso

Jarrod Rivituso (view profile)

Answer by Matt Tearle

Matt Tearle (view profile)

on 8 Apr 2011

A variation on Jarrod's approach, using function handles (because everyone loves function handles):

myFunc = @(t,b) exp(t*b); % or whatever
t0 = 0;
t1 = 3;
L = 50;
f = @(b) quad(@(t) myFunc(t,b),t0,t1);
bsolve = fzero(f,2);

Or fsolve instead of fzero if you have Optimization Toolbox.

0 Comments

Matt Tearle

Matt Tearle (view profile)

Answer by Walter Roberson

Walter Roberson (view profile)

on 11 Apr 2011

If you have the symbolic toolbox,

syms x b
solve(int(f(x,b),x,t0,t1)-L,b)

In theory if it can be solved symbolically it will do so, and if not then MuPad should switch to numeric integrations, I think.

0 Comments

Walter Roberson

Walter Roberson (view profile)

Contact us