How do i solve this equation system?

2 visualizaciones (últimos 30 días)
Karl Hjelte
Karl Hjelte el 27 de Abr. de 2021
Respondida: Alan Stevens el 28 de Abr. de 2021
Im trying to solve this equation system, and the only two unknown variables are d2 and w2, the rest have a numerical value.
Why does my answer give me complex roots, and even if I use "syms d2 w2 real", it wont give me an answer.
clear variables, clc
d1 = 13;
g = 9.81;
d3 = d1/2;
L2 = 72e3;
L3 = 40e3;
zb = 372;
zc = 290;
f1 = 0.02;
c2 = 89;
c3 = 45;
w1 = 2.1994;
w3 = 2.5615;
syms d2 w2
eq1 = g*zb - w2^2*(f1*L2/d2 + (c2+1)/2) == g*zc - w3^2*(f1*L3/d3 + (c3+1)/2);
eq2 = w1*d1^2 == w2*d2^2;
eq = [eq1, eq2];
var = [d2 w2];
sol = solve(eq, var);
d2 = double(sol.d2)
w2 = double(sol.w2)
%the answer should be: d2 = 10.86; w2 = 3.15;

Respuestas (1)

Alan Stevens
Alan Stevens el 28 de Abr. de 2021
Try fzero:
d1 = 13;
g = 9.81;
d3 = d1/2;
L2 = 72e3;
L3 = 40e3;
zb = 372;
zc = 290;
f1 = 0.02;
c2 = 89;
c3 = 45;
w1 = 2.1994;
w3 = 2.5615;
w2fn = @(d2) w1*d1^2/d2^2;
f2 = @(d2) g*zb - w2fn(d2)^2*(f1*L2/d2 + (c2+1)/2) - (g*zc - w3^2*(f1*L3/d3 + (c3+1)/2));
% Initial guess for d2
d20 = 100;
d2 = fzero(f2,d20);
w2 = w2fn(d2);
disp([d2, w2])
10.8615 3.1508

Community Treasure Hunt

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

Start Hunting!

Translated by