matlab初学者,编了小段程序,然后就出bug了,进行不下去了,求帮助啊!!!
k=0.87;
times=10000;
mon=24;
p0=0.9;
sigma=0.3;
mu=0.005 ;
aa=1000;
bb=2500;
randn('seed',0);
epsilon=randn(times,mon);
upperprofit=500;
dt=1;
dp=0;
price=zeros(times,mon);
for i=1:times
for j=1:mon
if(j=1)
dp=p0*mu*dt+sqrt(dt)*p0*sigma*epsilon(i,j);
price(i,j)=p0+dp;
else
dp=price(i,j-1)*mu*dt+sqrt(dt)*price(i,j-1)*sigma*epsilon(i,j);
price(i,j)=price(i,j-1)+dp;
end
end
end
运行的时候出现
??? if(j=1)
|
Error: The expression to the left of the equals sign is not a valid target for an assignment.
这种错误提示,请问怎么解决??