用solve来解不等式方程 ,因为我们想得到的是一个范围,所以在solve中要加一个'ReturnConditions','true'  

-----------------------------------------------------------(●'◡'●)-------------------------------------------------------------

(1)求解不等式,例如求这个delta>0的解

clear;
syms a b c d x;
a=0.48;
b=50;
c=0.6;
d=1;
delta=d^2*a^2-4*a*x*(1+b/c)  
S=solve(delta>0,x,'ReturnConditions',true)%解不等式
S.conditions%条件解

运行结果:

(2)求解不等式方程组

clear;
syms x y;
eq1=x>0;
eq2=y>0;
eq3=x^2+y^2+x*y<1;
eqs=[eq1 eq2 eq3];
S=solve(eqs,[x,y],'ReturnConditions',true)
S.x
S.y
S.conditions
S.parameters
disp ------------------------------------
[solx,soly,parameters,conditions] = solve(eqs,[x,y],'ReturnConditions',true)
%k可以求出S,再调用S中的条件解,也可以一行代码求出x y parameters conditions

运行结果:

-----------------------------------------------------------(●'◡'●)-------------------------------------------------------------

solve解不等式方程:

S=solve(eq,x,'ReturnConditions',true)

solve解不等式方程组:

S=solve(eqs,[x,y],'ReturnConditions',true)

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐