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 Comments

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!

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Release

R2020b

Asked:

on 16 Feb 2021

Commented:

on 16 Feb 2021

Community Treasure Hunt

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

Start Hunting!