How to to take a value positive of equation

14 次查看(过去 30 天)
Hello,
This equation solves two solutions and I want to take a value x2 positive (solutions is -7.6272 and 11.6272).
I tried the method abs(x2) that no help me.
Thanks in advance
clear;
syms x
fOut=1/80;
m=2;
s=5;
eqn = fOut -(exp(-0.5*((m-x)/s)^2)/(s*(2*pi)^0.5))== 0 ;
x2 = solve(eqn,x);
x1=2*m-x2;
fprintf('The equation has two solutions is x1=%.4f\n x2=%.4f\n',x1,x2);

采纳的回答

KSSV
KSSV 2020-11-27
sol = double(x2) ;
sol(sign(sol)==1)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by