Why is the solve() function not working properly?

Hello,
I am trying to solve for a variable Nt, from an equation with the form
When I try to solve it using the solve() function it outputs a negative number rather than what should be a positive number (I get -35.8471 when I implement the below MATLAB code). Is there something wrong with my implementation of this code?
clc; clear; close all;
k = 1167.490;
E = 30e6;
d = 0.625;
theta = 17*2*pi;
Dm = 3+1+d;
syms Nt
eqn = E*d^4/(10.8*(Dm*(Nt+theta)/Nt)*(Nt+(Nt/(3*pi)))) == k;
S = solve(eqn,Nt);
Snum = double(S);

3 个评论

It appears to be correct. I even checked it with:
syms Nt k E d theta Dm
eqn = E*d^4/(10.8*(Dm*(Nt+theta)/Nt)*(Nt+(Nt/(3*pi)))) == k;
pretty(eqn)
to be certain.
Unless there is some sort of error in the constants (no way to check that), the code should produce a correct result.
Just found that there was a typo in one of the variables. Now I'm getting correct values.
Thanks!!
My pleasure!
In retrospect, I should have posted that as an Answer!

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Mathematics 的更多信息

产品

版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by