"Solve" function and "overly precise" parameters??
Show older comments
So I've encountered a really weird problem trying to solve an implicit equation:
eq = eps == (1/Mi)*((2/(g+1))*(1+ ((g-1)/2)*Mi^2))^((g+1)/(2*(g-1)));
M1 = double(solve(eqi,Mi));
"eps" and "g" are given parameters, and Mi is what I'm trying to calculate. The thing is, when I use "g" with a single digit after a decimal point (I started with 1.2, but later found out 1.1, 1.3, 1, 2, etc), the code works like a charm. But when I try to be more precise (g = 1.21, 1.19, 1.2001), Matalb fails to solve the equation and gives me a strange value that is definitely incorrect. I also get a "warning: Cannot solve symbolically. Returning a numeric approximation instead. " orange error (it doesn't stop running).
It's the first time I've encountered something so weird, I can't even start to guess what the problem might be...
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!