Solving System of 4 Non-Linear Equations

조회 수: 33 (최근 30일)
Matlab12345
Matlab12345 2020년 4월 17일
편집: Stephan 2020년 4월 17일
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에서 Power and Energy Systems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by