Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double MBissec(){
- //Ka*e^(-Ka*tmax) - Ke*e^(-Ke*tmax) = 0
- double ke = 0.064 / 3400; //ke = ket/Vap
- int tMax = 2 * 60; //2horas (em minutos)
- double a, b;
- a = 0; b = 0.5;
- double Fa = Fka(a);
- double Fb = Fka(b);
- double c;
- while (b - a > 0.0001){
- c = (a + b) / 2;
- if (Fka(c) < 0)
- a = c;
- else
- b = c;
- }
- cout << "Ke = " << ke << endl;
- cout << "Ka = " << c << endl;
- return c;
- }
- double Fka(double x){
- //Ka*e^(-Ka*tmax) - Ke*e^(-Ke*tmax) = 0
- double ke = 0.064 / 3400; //ke = ket/Vap
- int tMax = 2; //2horas (em minutos)
- double result = x*exp(-x*tMax) - ke*exp(-ke*tMax);
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement