I wan to solve an equation on MATLAB. It involves five variables. After using solve function i am getting answer in terms of those variables and not as a integer. I Want real value . How can i get that?

3 visualizzazioni (ultimi 30 giorni)
syms Bw;
syms Rbwtobtf;
syms Hf;
syms Btf;
syms Mu;
syms d;
syms Fcu;
Bw=150;
Rbwtobtf=0.2;
Hf=70;
Btf=Bw/Rbwtobtf;
Fcu=30;
Mu=3400000000;
syms x;
d=solve('Mu==Fcu*Btf*x^2*(0.157*Rbwtobtf+(1-Rbwtobtf)*(Hf/x)*(0.45-0.225*(Hf/x)))',x);
here is the equation which i am unable to solve. Even double function is not giving the answer. please help.

Risposta accettata

John D'Errico
John D'Errico il 24 Mag 2017
Modificato: John D'Errico il 24 Mag 2017
There is NO need to predefine variables as symbolic, then define them as numbers. So most of those syms calls were a waste of time.
Next, DON'T put the equation in quotes! At least, not if you want MATLAB to use those variables that you just defined.
Bw=150;
Rbwtobtf=0.2;
Hf=70;
Btf=Bw/Rbwtobtf;
Fcu=30;
Mu=3400000000;
syms x;
d=solve(Mu==Fcu*Btf*x^2*(0.157*Rbwtobtf+(1-Rbwtobtf)*(Hf/x)*(0.45-0.225*(Hf/x))),x);
>> d
d =
- (100*110955233^(1/2))/471 - 63000/157
(100*110955233^(1/2))/471 - 63000/157
vpa(d)
ans =
-2637.6919301059145700205777681076
1835.1441594052776273454185324388
Finally, that you want the result to be an integer is completely irrelevant. You can want anything in the world, but the solution is not an integer, and wishing won't make it so. If you then take the floor or ceil of the result, or round it, it won't be a solution anymore.

Più risposte (2)

Torsten
Torsten il 24 Mag 2017
syms x
Bw=150;
Rbwtobtf=0.2;
Hf=70;
Btf=Bw/Rbwtobtf;
Fcu=30;
Mu=3400000000;
d=solve('Mu==Fcu*Btf*x^2*(0.157*Rbwtobtf+(1-Rbwtobtf)*(Hf/x)*(0.45-0.225*(Hf/x)))',x)
Best wishes
Torsten.
  3 Commenti
Torsten
Torsten il 24 Mag 2017
Are you sure you didn't define the other variables (Bw,Rbwtobtf,...) as "syms" again ?
Best wishes
Torsten.
vinay mhatre
vinay mhatre il 24 Mag 2017
no i haven't defined them as "syms". also when i copy one of the row from ans and assign it to other variable manually then i get the exact ans. bt i want to put this expression in for loop so cant do it manually.
kindly help

Accedi per commentare.


Walter Roberson
Walter Roberson il 24 Mag 2017
There are no integer solutions to those equations.
It is not very meaningful to ask for integer solutions to equations whose coefficients are approximate floating point numbers such as 0.157 . If you want integer solutions you should be using rational coefficients.
Note: there are no solutions to the equations if you convert the decimals into fractions of the appropriate power of 10, such as 0.157 being 157/1000.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by