필터 지우기
필터 지우기

How to perform Monte Carlo integration with vector inputs

조회 수: 1 (최근 30일)
Najeeb Ud Din
Najeeb Ud Din 2019년 4월 15일
답변: Najeeb Ud Din 2019년 4월 16일
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
James Tursa
James Tursa 2019년 4월 15일
We need more details. What is the integral you are calculating and what code have you written so far?

댓글을 달려면 로그인하십시오.

답변 (1개)

Najeeb Ud Din
Najeeb Ud Din 2019년 4월 16일
% 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

카테고리

Help CenterFile Exchange에서 Monte-Carlo에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by