Wrong solution using solve with a logarithmic
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I wanted to solve an equation containing a log function. The solution given by Matlab is not correct, until I multiply the logarithm by 10.
I'm aware of the difference between log and log10 and want to use the natural logarithm.
f_1 = 10* (eta_p/(b_pstern * g * eps_min))*(log(W_0/(W_0-B1)))== s*1000 ;
W_K_1 = double(solve(f_1, B1))
In the equation, everything is numeric except for B1. When I type the exact same equation into my calculator, I get the correct answer. The "10*" is the correction factor I use for the "correct" solution.
Am I using the log function wrong or is there some other error?
2 个评论
采纳的回答
Walter Roberson
2021-6-25
The outputs cross-check properly
format long g
syms B1
f_1 = (6314642578216891*log(-35316/(B1 - 35316)))/536870912 == 300000 % With *10
f_2 = (5051714062573513*log(-35316/(B1 - 35316)))/4294967296 == 300000 % Without *10
f1_sol = solve(f_1)
f2_sol = solve(f_2)
double(f1_sol)
subs(f_1, B1, f1_sol)
lhs(ans)-rhs(ans)
double(f2_sol)
subs(f_2, B1, f2_sol)
lhs(ans)-rhs(ans)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!