How do i solve this equation system?

15 ビュー (過去 30 日間)
Karl Hjelte
Karl Hjelte 2021 年 4 月 27 日
回答済み: Alan Stevens 2021 年 4 月 28 日
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;

回答 (1 件)

Alan Stevens
Alan Stevens 2021 年 4 月 28 日
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

カテゴリ

Help Center および File ExchangeEquation Solving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by