Why is the solve() function not working properly?
Show older comments
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 Comments
Star Strider
on 16 Feb 2021
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.
Gregorio Cuaresma
on 16 Feb 2021
Star Strider
on 16 Feb 2021
My pleasure!
In retrospect, I should have posted that as an Answer!
Answers (0)
Categories
Find more on Mathematics 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!