Solving System of 4 Non-Linear Equations

8 visualizaciones (últimos 30 días)
Matlab12345
Matlab12345 el 17 de Abr. de 2020
Editada: Stephan el 17 de Abr. de 2020
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?

Respuesta aceptada

Stephan
Stephan el 17 de Abr. de 2020
Editada: Stephan el 17 de Abr. de 2020
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

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by