How to integrate between a defined and an undefined limit
Afficher commentaires plus anciens
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);
Réponses (1)
Torsten
le 16 Mar 2015
syms x xend
a=int(x+5*x^2,0,xend);
Best wishes
Torsten.
1 commentaire
Trond Oesten
le 16 Mar 2015
Modifié(e) : Trond Oesten
le 16 Mar 2015
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!