Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1471
Number of posts: 2147

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Need some help using solve Posted by Helal on 11 Feb 2013 at 7:05 PM
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?



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.