How to integrate between a defined and an undefined limit

1 view (last 30 days)
Hi,
I have performed an double integration of a function containing 3 variables. The function is now only dependent on 1 varaible. Is there an easy way I can integrate the function for this last variable to, but I want it to go between a defined value (lets say 0) and an undefined variable (a). Is there an easy way to do this? or should this be performed as a tripple integral right away? Thanks!
My script:
clc; clear all; close all;
C = [23.875 15.75281; 15.75281 93.9842];
mu_U = 1788.2058;
mu_K = 70.8489;
sigma_U = sqrt(C(1,1));
sigma_k = sqrt(C(2,2));
ubot = mu_U-4*sigma_U;
utop = mu_U+4*sigma_U;
kbot = mu_K-4*sigma_k;
ktop = mu_K+4*sigma_k;
xbot = 0;
xtop = @(a) a;
mu = [mu_U;mu_K];
% Double integral
fun = @(x,u,k) wblpdf(x,u,k).*reshape(mvnpdf([u(:),k(:)],mu(:).',C),size(u));
qfun_scalar = @(x)integral2(@(u,k)fun(x,u,k),ubot,utop,kbot,ktop);
uncpdf = @(x)arrayfun(qfun_scalar,x);
% Tripple integral
qfun_scalar2 = @(a)integral3(@(x,u,k)fun(x,u,k),xbot,xtop,ubot,utop,kbot,ktop);
unccdf = @(a)arrayfun(qfun_scalar2,a);

Answers (1)

Torsten
Torsten on 16 Mar 2015
syms x xend
a=int(x+5*x^2,0,xend);
Best wishes
Torsten.
  1 Comment
Trond Oesten
Trond Oesten on 16 Mar 2015
Edited: Trond Oesten on 16 Mar 2015
Sorry. I was not clear enough in my question. I have updated my question above

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!