フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Help limiting my Monte Carlo Solution

1 回表示 (過去 30 日間)
Mike
Mike 2014 年 3 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello,
I have to write a code to determine a Monte Carlo solution for a PDE problem. The range goes from zero to pi and the limiting factor is the sin wave. My problem that i am experiencing is that my current code stops at on and not the limit of the sin wave. Can someone take a look at the code and see where i made my mistake?
clear; clc;
n = 1000;
x = linspace(0,1,n);
Xinside = [];
dist_X = [];
figure(1)
clf;
syms p
bc = sin (p);
Range = [0 pi];
h = ezplot(bc,Range);
hold on
distance = zeros(0,1,n);
for t = 1:n
a = 0;
b = 1;
Xn = a + b*rand();
Xn(t) = (Xn + Xn)<=1;
plot(Xn);
%distance(t) = sum(distance(1:t) <=1);
%est_pi = 4*Xinside(1:t)./(1:t);
%plot(est_pi);
ylabel('estimation')
xlabel('iteration')
end
hold off

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by