-1

当我尝试运行这个程序时:

n = 10000;

Constant = 5.0;
A = 10; 
B = 5;
C = 1.335;
Drand = (0.02*randn(1,n)) + 0.242*ones(1,n);
Erand = (0.005*randn(1,n)) + 0.536*ones(1,n); 
P = (Constant*A*B*(1.0/C))*(Drand.*(1.0-Erand.));
plot(P);

我收到此错误:

错误:应为“标识符”,找到“)”。

其中方差分别为0.020.005,均值分别为0.2420.536

4

1 回答 1

4

.在倒数第二行写的太多了。它应该是:

 P = (Constant*A*B*(1.0/C))*(Drand.*(1.0-Erand));

此外,您的方差实际上不是0.02and 0.005。想想看;-)

于 2012-08-24T05:59:59.657 回答