Solve for parameters of an integral (fsolve?)

2 次查看(过去 30 天)
Dear All, let a,c,d,e be real number parameters. Let x also be a parameter, which I would like to solve the attached equation for (using matlab). f(y) is a density function (for the beginning it can be a normal distribution). Can anyone point towards the general strategy to solve this and some useful commands?
Thanks in advance!

回答(1 个)

Matt J
Matt J 2016-10-27
编辑:Matt J 2016-10-27
FZERO would be enough, I expect, since it is a 1D root finding problem. You can use commands like TRAPZ or INTEGRAL to get a numerical approximation of the integral. Also, in the case of a normal distribution, f(y), the integral of the terms (d+x)*f(y) can be evaluated using calls to the ERF command while the term y*f(y) has a closed analytical form.
  2 个评论
Matt J
Matt J 2016-10-29
roblocks replied
Dear Matt, thanks! I tried to implement, but I am running into a problem using the integral command. In a later version I want to solve for r. For now assume r is given and I would just like to compute the integral. The following code produces an error:
clear all; clc;
epsilon = 0.5;
r = 1.08;
D = 10;
r_s = 1.01;
mu = -1;
sigma = 8;
E_guess = 12;
r_guess = 1.08;
% define my function that is to be integrated over epsilon
second_summand = @(epsilon,r,D,r_s, mu, sigma, E_guess, r_guess)
((r*D+E_guess - (r_guess-1)-epsilon)*normpdf(epsilon,mu,sigma));
second_summand(epsilon,r,D,r_s, mu, sigma, E_guess, r_guess)
disp('second_summand function seems to be working.')
% clear epsilon to have it as a variable
clear epsilon
lb = E_guess - (r_guess-1)
ub = E_guess - (r_guess-1)+r*D
% compute the integral
integral( @(epsilon)
second_summand(epsilon,r,D,r_s, mu, sigma, E_guess, r_guess) ,lb , ub)
It simply copied what the integral reference page is suggesting for syntax if one uses parametric integrals.
Matt J
Matt J 2016-10-29
Use .* in your definition of second_summand so that it gives vectorized output.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by