Effacer les filtres
Effacer les filtres

numerical integration of array

4 vues (au cours des 30 derniers jours)
Muna Tageldin
Muna Tageldin le 14 Avr 2023
Déplacé(e) : Torsten le 14 Avr 2023
I'm trying to integrate the following series to compute the expected value
$F_Z(z)=\sum_{i=0}^n \frac{n!}{i!(n-i)! (\lambda-n*\mu)} (-\epsilon)^{i} (1-e^{-\mu z})^{n-i}*(e^{-\lambda z}-e^{-\mu*z})$
using expected value denfition
Throught my research and looking up the integral defition, I can use integral function in MATLAB. I tried finding the integration for a simple model by the following steps
1) define array function for
nCk = @(n,kVec,z)arrayfun(@(k)nchoosek(n,k)*exp(-lam*k*z),kVec);
integral(@(z) nCk(10,1:5),0,1,'ArrayValued',true)
However, I got the error "Not enough input arguments"

Réponse acceptée

Torsten
Torsten le 14 Avr 2023
Déplacé(e) : Torsten le 14 Avr 2023
lam = 0.5;
nCk = @(n,kVec,z)arrayfun(@(k)nchoosek(n,k)*exp(-lam*k*z),kVec);
integral(@(z) nCk(10,1:5,z),0,1,'ArrayValued',true)
ans = 1×5
7.8694 28.4454 62.1496 90.7898 92.5258

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by