matlab编程问题 ,不知哪里出错S0=50;K=5;r=0.2;sigma=0.3;T=0.5;q=0;random_A=randn(1000);a=428.5912b=246.7252c=-801.6449for i=1:10; for j=1:100; A(i,j)=S0*exp((r-sigma^2/2)*T+sigma*random_A(i,j)*sqrt(T)); if A(i,j)>K; b*A(i,j)+c *(A(i,j)^2)-A(i
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 05:45:12
matlab编程问题 ,不知哪里出错S0=50;K=5;r=0.2;sigma=0.3;T=0.5;q=0;random_A=randn(1000);a=428.5912b=246.7252c=-801.6449for i=1:10; for j=1:100; A(i,j)=S0*exp((r-sigma^2/2)*T+sigma*random_A(i,j)*sqrt(T)); if A(i,j)>K; b*A(i,j)+c *(A(i,j)^2)-A(i
matlab编程问题 ,不知哪里出错
S0=50;
K=5;
r=0.2;
sigma=0.3;
T=0.5;
q=0;
random_A=randn(1000);
a=428.5912
b=246.7252
c=-801.6449
for i=1:10;
for j=1:100;
A(i,j)=S0*exp((r-sigma^2/2)*T+sigma*random_A(i,j)*sqrt(T));
if A(i,j)>K;
b*A(i,j)+c *(A(i,j)^2)-A(i,j)>-K-a;
B(i,j)=0;
else B(i,j)=a +b*A(i,j)+c*(A(i,j) ^2);
end
end
end
B
B
Columns 1 through 14
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
Columns 99 through 100
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
不懂为什么全是0?
matlab编程问题 ,不知哪里出错S0=50;K=5;r=0.2;sigma=0.3;T=0.5;q=0;random_A=randn(1000);a=428.5912b=246.7252c=-801.6449for i=1:10; for j=1:100; A(i,j)=S0*exp((r-sigma^2/2)*T+sigma*random_A(i,j)*sqrt(T)); if A(i,j)>K; b*A(i,j)+c *(A(i,j)^2)-A(i
if A(i,j)>K;
b*A(i,j)+c *(A(i,j)^2)-A(i,j)>-K-a;
B(i,j)=0;
所给条件一直符合这段程序,所以结果为0