📄 s2rout1.m
字号:
% Routine 2.1A = 1; % area of enclosing rectangle N = 10000; % set the number of trialss = 0; % initialize the success counterfor i = 1:N % begin trials x = rand; % choose a random x-coordinate y = rand; % choose a random y-coordinate if y <= exp(-x^3) % if below the curve, then s = s + 1; % increment successes end; % end if end; % end of each trialI = A*s/N % integral= area*success/trials
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -