Filter löschen
Filter löschen

Solve an equation while we have an if statement that makes the coefficient depends on the variable

5 Ansichten (letzte 30 Tage)
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

Antworten (1)

Walter Roberson
Walter Roberson am 28 Mai 2022
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.

Kategorien

Mehr zu Statics and Dynamics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by