Need some help using solve - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need some help using solve

HelalHelal Posts: 2Member
Hello everybody,

I'm facing some troubles trying to use the solve function. I'm getting the wrong value. I did all the calculations on paper and I'm getting a different answer.

So, here is my code:

a1 = 2.3; % cm cubicos
a2 = 2.3; % cm cubicos
a3 = 2.3; % cm cubicos
a4 = 2.3; % cm cubicos
A1 = 730; % cm cubicos
A2 = 730; % cm cubicos
A3 = 730; % cm cubicos
A4 = 730; % cm cubicos
v1 = 0.6; % 60% = 60/100 = 0.6
v2 = 0.6; % 60% = 60/100 = 0.6
k1 = 5.51; % cm cubicos / segundo
k2 = 6.58; % cm cubicos / segundo
g = 981; % cm / segundo ao quadrado
gama1 = 0.333;
gama2 = 0.307;
gama3 = 0.333; % gama3 = 1 - gama4
gama4 = 0.667; % gama4 = 1 - gama1

syms h4;

rh4 = solve((-a4/A4)*(2*g*h4)^(0.5) + ((gama4*k1)/A4)*v1, h4);
disp(h4);

So, if you do the math on paper, you expect to find
h4 = 0.000468492

But the matlab is giving me
h4 = 17953715759368072310851915890294825625/38322307732477017073753209451412474298368

So, does anyone know what is going on?
Sign In or Register to comment.