用matlab解一个二元方程组,会的进,得到解再回答

问题描述:

用matlab解一个二元方程组,会的进,得到解再回答
tan(4*3.14*20000*0.03)+2*3.14*20000/k1*tan(k1*x)=0
k1=sqrt(4*3.14^2*20000^2*7840/2.1e11-log(2)*log(2)/x^2)

clear,clc
format long
f=@(x)[tan(4*3.14*20000*0.03)+2*3.14*20000/x(1)*tan(x(1)*x(2));
sqrt(4*3.14^2*20000^2*7840/2.1e11-log(2)*log(2)/x(2)^2)-x(1)];
[s,v]=fsolve(f,[24;0.1])
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance,and
the problem appears regular as measured by the gradient.
s =
23.698316600893644
0.132572516762675
v =
1.0e-011 *
0.327282645429250
0
所以就是k1=23.698316600893644,x=0.132572516762675
换用不同的初值会有不同的结果
或者直接用solve
clear,clc
s = solve('tan(4*3.14*20000*0.03)+2*3.14*20000/k1*tan(k1*x)=0',...'k1=sqrt(4*3.14^2*20000^2*7840/2.1e11-log(2)*log(2)/x^2)');
disp('k1='); disp(s.k1); disp('x='); disp(s.x);