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!