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?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
vinay mhatre
am 24 Mai 2017
Beantwortet: Walter Roberson
am 24 Mai 2017
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.
0 Kommentare
Akzeptierte Antwort
John D'Errico
am 24 Mai 2017
Bearbeitet: John D'Errico
am 24 Mai 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.
Weitere Antworten (2)
Torsten
am 24 Mai 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 Kommentare
Torsten
am 24 Mai 2017
Are you sure you didn't define the other variables (Bw,Rbwtobtf,...) as "syms" again ?
Best wishes
Torsten.
Walter Roberson
am 24 Mai 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.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!