Borrar filtros
Borrar filtros

How to perform Monte Carlo integration with vector inputs

1 visualización (últimos 30 días)
Najeeb Ud Din
Najeeb Ud Din el 15 de Abr. de 2019
Respondida: Najeeb Ud Din el 16 de Abr. de 2019
I am try to solve a double integral whose two varibles are generated using rand () function.However i have another vector indepent of two variable and for each of the value of this vector i have to calcuate the integral.
regards
  1 comentario
James Tursa
James Tursa el 15 de Abr. de 2019
We need more details. What is the integral you are calculating and what code have you written so far?

Iniciar sesión para comentar.

Respuestas (1)

Najeeb Ud Din
Najeeb Ud Din el 16 de Abr. de 2019
% I want simulate this integral(attached file) .
clc;
clear all;
temp =0;
syms Z
a=1.5 ; % except a=1
EB_NO_dB= 1:5;
Q=(10).^(EB_NO_dB/10);
V=[Q];
Total=[];
for L1=1:length(V)
EbNon = V(L1) ;
w=((10)^(5)).*rand(10,1); % Monte Carlo Simulations
for L2=1:length(w)
s2= w(L2) ;
O=(pi/2).*rand(10,1);
for L3=1:length(O)
s3 =O(L3);
beta= 4*(1.78)^((2/a)-1);
B= (a/(2*(a-1)));
A=(beta*s2)^(B);
D=(a/a-1);
C=(cos(s3)/sin(a*s3))^(D);
E=(cos((a-1)*s3))/(cos(s3));
F=s2/EbNon;
T=exp(-(A*C*E)+(-F));
S4=0
S4=S4+T;
end
end
total=S4;
LUMSUM=((1/pi)*(EbNon))*total*(1/(10)^5)*(pi/2)*((10)^5);
temp=0;
temp=LUMSUM;
Total=[Total temp];
end
semilogy(EB_NO_dB,Total,'-*','LineWidth',1)
axis([0 30 10^-3 1])
grid on

Categorías

Más información sobre Monte-Carlo en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by