matlab 解2元方程1/6+(5/6)/(1+exp(1.702*x*y))=1/21/6+(5/6)/(1+exp(-1.702*x*(1-y)))=1写出 matlab 的计算代码
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 02:24:26
matlab 解2元方程1/6+(5/6)/(1+exp(1.702*x*y))=1/21/6+(5/6)/(1+exp(-1.702*x*(1-y)))=1写出 matlab 的计算代码
matlab 解2元方程
1/6+(5/6)/(1+exp(1.702*x*y))=1/2
1/6+(5/6)/(1+exp(-1.702*x*(1-y)))=1
写出 matlab 的计算代码
matlab 解2元方程1/6+(5/6)/(1+exp(1.702*x*y))=1/21/6+(5/6)/(1+exp(-1.702*x*(1-y)))=1写出 matlab 的计算代码
直接用solve解不行,先进行整合.
f1='1/6+(5/6)/(1+exp(1.702*xy))-1/2'%把x*y当成一个变量
xy=solve(f1)%求解xy的值
f2='1/6+(5/6)/(1+exp(-1.702*x+1.702*xy))-1'%展开
f3=subs(f2,'xy',xy)%把xy的值代f2
x=solve(f3)%求解x
f4='1/6+(5/6)/(1+exp(1.702*x*y))-1/2'%再拆开xy
f5=subs(f4,'x',x)%代入x
y=solve(f5)%求解y
运行结果:
f1 =1/6+(5/6)/(1+exp(1.702*xy))-1/2
xy =.23822861815990856755464930403311
f2 =1/6+(5/6)/(1+exp(-1.702*x+1.702*xy))-1
f3 =-5/6+5/6/(1+exp(-1.702*x+.40546510810816438197801311546435))
x =185.69932338571710748362082828445
f4 =1/6+(5/6)/(1+exp(1.702*x*y))-1/2
f5 =-1/3+5/6/(1+exp(316.06024840249051693712264974013*y))
y =.12828728388260336678414831727309e-2
验证答案:
>> 1/6+(5/6)/(1+exp(1.702*x*y))
ans =
.50000000000000000000000000000000
>> 1/6+(5/6)/(1+exp(-1.702*x*(1-y)))
ans =
1.0000000000000000000000000000000