Solve an equation while we have an if statement that makes the coefficient depends on the variable
조회 수: 5 (최근 30일)
이전 댓글 표시
I want to solve this
M=166700; %kg%;
g=9.81; %m/s2%;
ro=2500; %kg/m3%;
H=6; %m%;
sigmac=20*(10^6); %Pa%
syms d;
if(d<0.8)
F2=3*(10^6)*(d^2)-30644;
M1=5*(10^7)*(d^2)-552844;
else
F2=103867*(d^2)+(10^6);
M1=2*(10^6)*d^2+2*(10^7);
end
F1=17759*(d^2)+1801.8;
m=sigmac-(M*g/(d^2))-2*ro*H*g+(6*H*F1/(2*(d^3)))+(6*H*F2/(d^3))+(M1*6/(d^3));
fsolve(m,d)
I am not getting an answer because the if test cannot be done without a value for d. Value that I aim to find by this code
댓글 수: 1
답변 (1개)
Walter Roberson
2022년 5월 28일
typically the best way to solve these situations is to run both branches separately, vpasolve() each of the branches, test each result to see if it is within the constraints for the branch. There might be several answers.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Statics and Dynamics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!