Borrar filtros
Borrar filtros

How to to take a value positive of equation

9 visualizaciones (últimos 30 días)
Emilia
Emilia el 27 de Nov. de 2020
Comentada: Emilia el 27 de Nov. de 2020
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);

Respuesta aceptada

KSSV
KSSV el 27 de Nov. de 2020
sol = double(x2) ;
sol(sign(sol)==1)

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by