Solving a large equation

16 Ansichten (letzte 30 Tage)
Nicholas
Nicholas am 2 Sep. 2014
Kommentiert: Walter Roberson am 25 Mär. 2020
I have a large equation of the form:
8.5567=10.75-158.34*y+2112.07*y^2-12211.07*y^3-29.44*x+2185.91*x*y-35690.08*x*y^2+187137.42*x*y^3+129.16*x^2-9697.93*x^2*y+173834.73*x^2*y^2-935832.82*x^2*y^3-174.03*x^3+13191.71*x^3*y-245488.55*x^3*y^2+1384550.57*x^3*y^3
For x ranging from 0.15 to 0.39 I want to develop the value(s) of y.
Any ideas on how to do this would be greatly appreciated.
Thank you.

Antworten (3)

Roger Stafford
Roger Stafford am 2 Sep. 2014
Bearbeitet: Roger Stafford am 2 Sep. 2014
You can use 'roots'. For each value of x you can compute the corresponding value of each of the four coefficients of the powers of y. For example the powers of y^3 can be collected to form a single coefficient which would be:
c3(x) = -12211.07+187137.42*x-935832.82*x^2+1384550.57*x^3
Use a for-loop:
x = linspace(0.15,0.39,n); % You choose n (= 25?)
y = zeros(n,3);
for k = 1:n
y(k,:) = roots([c3(x(k)),c2(x(k)),c1(x(k)),c0(x(k))]).'; % Get three y roots each trip
end
This gives you an n x 3 array of the corresponding possible values of y, some of which may be complex-valued, depending on the numbers you are using.
You may wish to reorder the rows in y you obtain this way in order to preserve continuity in the three branches. That would be an extra step.

MJTHDSN
MJTHDSN am 12 Apr. 2018
Dear Matlabers,
I have a similar question but a little bit confusing. Let`s assume we have 6 equations as below:
EQ1:a{{(L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)}}=(L^2)*(T^2)-2*L*(T^2)+ (T^2)-(2*L*T*B)+(T*B)+(B^2)
EQ2: b{{(L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)}}=(L^2)*(T^2)+(2*L*T*B)+(B^2)
EQ3: c{{(L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)}}=(T^2)+(2*T*B)+(B^2)
EQ4:d{{(L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)}}=(L^2)*(T^2)-2*L*(T^2)+ (T^2)-(2*L*T*B)-(T*B)+(B^2)
EQ5: e{{(L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)}}=(L^2)*(T^2)-(2*L*T*B)+(B^2)
EQ6: f{{(L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)}}=(T^2)-(2*T*B)+(B^2)
in the equations above a,b,c,d,e and f are the numerical known values (0.543 for example). So we have 6 equations with 5 unknowns as L, Z, M, T and B.
Can you please give me cues how to solve the equations to find these unknowns using MATLAB.
Best Regards,
  5 Kommentare
Walter Roberson
Walter Roberson am 24 Mär. 2020
If you post your equations, we could try to solve them.
Walter Roberson
Walter Roberson am 25 Mär. 2020
syms B L M T Z
Q = @(v) sym(v);
a = sqrt(Q(2)); b = Q(3); c = Q(-5); d = 1/Q(7); e = Q(11); f = sqrt(Q(13));
EQ1 = a*(((L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)))==(L^2)*(T^2)-2*L*(T^2)+ (T^2)-(2*L*T*B)+(T*B)+(B^2);
EQ2 = b*(((L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)))==(L^2)*(T^2)+(2*L*T*B)+(B^2);
EQ3 = c*(((L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)))==(T^2)+(2*T*B)+(B^2);
EQ4 = d*(((L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)))==(L^2)*(T^2)-2*L*(T^2)+ (T^2)-(2*L*T*B)-(T*B)+(B^2);
EQ5 = e*(((L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)))==(L^2)*(T^2)-(2*L*T*B)+(B^2);
EQ6 = f*(((L^2)*(Z^2)+(L^2)*(M^2)-2*L*(Z^2)+(Z^2)))==(T^2)-(2*T*B)+(B^2);
EQN = [EQ1, EQ2, EQ3, EQ4, EQ5, EQ6];
sol = vpasolve(EQN, [B L M T Z]);
temp = struct2cell(sol);
disp(vertcat(temp{:}));
The result turns out to be all-zero.

Melden Sie sich an, um zu kommentieren.


Adithya Valavi
Adithya Valavi am 24 Mär. 2020
Did you know how to slove these equations then plz tell us tooo

Community Treasure Hunt

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

Start Hunting!

Translated by