Solve for parameters of an integral (fsolve?)

2 Ansichten (letzte 30 Tage)
roblocks
roblocks am 27 Okt. 2016
Kommentiert: Matt J am 29 Okt. 2016
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!

Antworten (1)

Matt J
Matt J am 27 Okt. 2016
Bearbeitet: Matt J am 27 Okt. 2016
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 Kommentare
Matt J
Matt J am 29 Okt. 2016
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 am 29 Okt. 2016
Use .* in your definition of second_summand so that it gives vectorized output.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by