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
Star Strider
2021년 2월 16일
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
2021년 2월 16일
Star Strider
2021년 2월 16일
My pleasure!
In retrospect, I should have posted that as an Answer!
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!