Solving System of 4 Non-Linear Equations

19 次查看(过去 30 天)
I have a system of four non-linear equations with four unknowns as have tried coding it as follows:
syms A B t0 C
eq1 = A*sin(2*B*3.1416*0.2 + 2*B*3.1416*(0 - t0)^2)+C - sin(2*3.1416*0.2)
eq2 = A*sin(2*B*3.1416*0.4 + 2*B*3.1416*(0 - t0)^2)+C - sin(2*3.1416*0.4)
eq3 = A*sin(2*B*3.1416*0.5 + 2*B*3.1416*(0 - t0)^2)+C - sin(2*3.1416*0.5)
eq4 = A*sin(2*B*3.1416*0.7 + 2*B*3.1416*(-t0)^2)+C - sin(2*3.1416*0.7)
sol = fsolve(eq1,eq2,eq3,eq4);
sol.xo
However, I get an error saying that fsolve requires the input x0 to be of data type double. How would I obtain the solution of this system using commands that do not require additional toolboxes?

采纳的回答

Stephan
Stephan 2020-4-17
编辑:Stephan 2020-4-17
fsolve is a numerical solver - use vpasolve instead:
syms A B C t0
eq1 = A*sin(2*B*pi*0.2 + 2*B*pi*(0 - t0)^2)+C - sin(2*pi*0.2);
eq2 = A*sin(2*B*pi*0.4 + 2*B*pi*(0 - t0)^2)+C - sin(2*pi*0.4);
eq3 = A*sin(2*B*pi*0.5 + 2*B*pi*(0 - t0)^2)+C - sin(2*pi*0.5);
eq4 = A*sin(2*B*pi*0.7 + 2*B*pi*(-t0)^2)+C - sin(2*pi*0.7);
result = vpasolve([eq1,eq2,eq3,eq4]);
A = result.A
B = result.B
C = result.C
t0 = result.t0
I allowed myself to replace 3.1416 by pi

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by