Azzera filtri
Azzera filtri

SOLVE querry

1 visualizzazione (ultimi 30 giorni)
Akshayy Garg
Akshayy Garg il 14 Giu 2011
[EDIT: 20110614 09:07 - reformat - WDR]
Hi
I am trying to run the following code but its taking too long.
syms a b c
f(1)=4576632.912*(a.^1.75)+152579042.4*(a.^2)-2364.98637*((0.008-a).^1.75)-(4576632.912*(b.^1.75)+152579042.4*(b.^2));
f(2)=4576632.912*(b.^1.75)+152579042.4*(b.^2)-2364.98637*((0.008-a-b).^1.75)-(4576632.912*(c.^1.75)+152579042.4*(c.^2));
f(3)=a+b+c-0.008;
[A,B,C]=solve(f(1),f(2),f(3))
  1. Kindly suggest an alternative.
  2. Also is there a way to initialize a b c like i can give a=b=c initially.
  3. the eqns are f(1),f(2) and f(3). if there is another way to solve the same.
Akshayy Garg

Risposte (1)

Walter Roberson
Walter Roberson il 14 Giu 2011
Are you expecting "a", "b", and "c" to be purely positive reals? If not then what meaning do you want to give to raising those values to the floating point power 1.75 ?
If you substitute the definition for c in to f(1) and f(2) you can reduce this to two equations in two variables. If you solve the parts for a in terms of b, and subtract the two and solve for 0, you find you are working with balancing the roots of a 32 degree polynomial against the roots of a 16 degree polynomial (I think it is). I am not convinced at the moment that any real roots exist.
I do not see how you can justify having some constants to 3 decimal places, some to 5, some to 2, and some of them to only 1 decimal place. The 32 degree polynomial needed to solve the expression becomes more or less numeric trash under those conditions.
  1 Commento
Akshayy Garg
Akshayy Garg il 14 Giu 2011
Hi
thnx a lot. I will try using 2 equations surely.
but i got it working using fsolve. as below:
F=inline('[4576632.912*(V(1).^1.75)+152579042.4*(V(1).^2)-2364.98637*((0.008-V(1)).^1.75)-(4576632.912*(V(2).^1.75)+152579042.4*(V(2).^2)); 4576632.912*(V(2).^1.75)+152579042.4*(V(2).^2)-2364.98637*((0.008-V(1)-V(2)).^1.75)-(4576632.912*(V(3).^1.75)+152579042.4*(V(3).^2)); V(1)+V(2)+V(3)-0.008]', 'V')
ig=[(0.008/3);(0.008/3);(0.008/3)];
Options = optimset('Display','iter');
XYZ = fsolve(F, ig, Options);
and the answers are:
a= 0.002666876643911
b= 0.002666602440224
c= 0.002666520915865
thnx a lot again..

Accedi per commentare.

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by