How to to take a value positive of equation

조회 수: 30 (최근 30일)
Emilia
Emilia 2020년 11월 27일
댓글: Emilia 2020년 11월 27일
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에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by