应用于方程组的MATLAB'求解'给出了一个不满足其中一个方程的解决方案

时间:2014-01-21 20:44:11

标签: matlab symbolic-math

我正在使用MATLAB函数'solve'来解决六个方程和六个变量的系统。在它给出的解决方案中,至少有一个方程似乎不满足。这是我的问题代码:

% given parameters
alpha = .05;        % exogenous rate of cost reductions
sigma = .05;         % exogenous uncertainty (infinitessimal st dev)
p0 = 10;             % initial carbon price
p1 = 50;            % carbon price under policy
lambda_p = .05;     % Poisson arrival rate of policy
lambda_q = .01;     % Probability of reversion to no policy state
r = .03;            % discount rate

% exponents for solution
beta1 = (.5*sigma^2 + alpha + sqrt((.5*sigma^2 + alpha)^2 + 2*sigma^2*(r+lambda_p)))/sigma^2;
beta2 = (.5*sigma^2 + alpha - sqrt((.5*sigma^2 + alpha)^2 + 2*sigma^2*(r+lambda_p)))/sigma^2;
beta3 = (.5*sigma^2 + alpha - sqrt((.5*sigma^2 + alpha)^2 + 2*sigma^2*r))/sigma^2;
beta4 = (.5*sigma^2 + alpha - sqrt((.5*sigma^2 + alpha)^2 + 2*sigma^2*(r+lambda_p+lambda_q)))/sigma^2;

syms a0 a1 ka ks B1 B2

S = solve(p1 - a1 == (lambda_p*lambda_q*ka*a1^beta3 + lambda_q*ks*a1^beta4)/(lambda_p + lambda_q), ...
    -1 == (lambda_p*lambda_q*ka*beta3*a1^(beta3-1) + lambda_q*ks*beta4*a1^(beta4-1))/(lambda_p + lambda_q), ... 
    p0 - a0 == B1*a0^beta1 + B2*a0^beta2 - lambda_p*a0/(alpha+lambda_p+r) + lambda_p*p1/(r+lambda_p), ... 
    -1 == B1*beta1*a0^(beta1-1) + B2*beta2*a0^(beta2-1) - lambda_p/(alpha+lambda_p+r), ... 
    (lambda_p*lambda_q*ka*a1^beta3 - lambda_p*ks*a1^beta4)/(lambda_p + lambda_q) == B1*a1^beta1 + B2*a1^beta2 - lambda_p*a1/(alpha+lambda_p+r) + lambda_p*p1/(r+lambda_p), ... 
    (lambda_p*lambda_q*ka*beta3*a1^(beta3-1) - lambda_p*ks*beta4*a1^(beta4-1))/(lambda_p + lambda_q) == B1*beta1*a1^(beta1-1) + B2*beta2*a1^(beta2-1) - lambda_p/(alpha+lambda_p+r));

不满足第三个等式。当我获得输出S时,我计算

>> p0-S.a0

ans =

-51.139888401602841212761952348352

>> S.B1*S.a0^beta1 + S.B2*S.a0^beta2 - lambda_p*S.a0/(alpha+lambda_p+r) + lambda_p*p1/(r+lambda_p)

ans =

4.58887467530944339251344448794

不相等。关于什么是错的任何想法?感谢。

0 个答案:

没有答案