现有两个符号等式,怎样用matlab求出p1和pn啊...求大神给出程序!(等式在追问里面)1-2*p1+c+(pn-c)*(y*k-y*q)/k*q/(k-q)=0和t*(k-q-pn+(t*pn-y*k+y*q+y*p1*k-y*p1*q)/t/k*q)/(k-q)+(pn-c)*t*(-1+1/k*q)/(k-q)=0
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 14:17:42
现有两个符号等式,怎样用matlab求出p1和pn啊...求大神给出程序!(等式在追问里面)1-2*p1+c+(pn-c)*(y*k-y*q)/k*q/(k-q)=0和t*(k-q-pn+(t*pn-y*k+y*q+y*p1*k-y*p1*q)/t/k*q)/(k-q)+(pn-c)*t*(-1+1/k*q)/(k-q)=0
现有两个符号等式,怎样用matlab求出p1和pn啊...求大神给出程序!(等式在追问里面)
1-2*p1+c+(pn-c)*(y*k-y*q)/k*q/(k-q)=0和t*(k-q-pn+(t*pn-y*k+y*q+y*p1*k-y*p1*q)/t/k*q)/(k-q)+(pn-c)*t*(-1+1/k*q)/(k-q)=0
现有两个符号等式,怎样用matlab求出p1和pn啊...求大神给出程序!(等式在追问里面)1-2*p1+c+(pn-c)*(y*k-y*q)/k*q/(k-q)=0和t*(k-q-pn+(t*pn-y*k+y*q+y*p1*k-y*p1*q)/t/k*q)/(k-q)+(pn-c)*t*(-1+1/k*q)/(k-q)=0
ep1 = '1-2*p1+c+(pn-c)*(y*k-y*q)/k*q/(k-q)=0';
ep2 = 't*(k-q-pn+(t*pn-y*k+y*q+y*p1*k-y*p1*q)/t/k*q)/(k-q)+(pn-c)*t*(-1+1/k*q)/(k-q)=0';
[p1,p2] = solve(ep1,ep2)
p1 =
-k*(-2*p1^2-1+3*p1-c+p1*c)/(-pn*k+c*k+2*pn^2-3*pn*c+c^2)
p2 =
k*(1-2*p1+c)/q/(-pn+c)
syms p1 pn c k y q t;
[ans_p1, ans_pn] = solve(1-2*p1+c+(pn-c)*(y*k-y*q)/k*q/(k-q)==0, t*(k-q-pn+(t*pn-y*k+y*q+y*p1*k-y*p1*q)/t/k*q)/(k-q)+(pn-c)*t*(-1+1/k*q)/(k-q)==0, p1, pn);
ans_p1 ans_pn就是答案