Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.