Retrieve a variable from a function

Hi,
I have tried the following:
syms p(n,m,b,d,t)
p(n,m,b,d,t)=((n-m)*((1/b)-(1/d)+ ((n-m)*t)/(n*b*d)))
I know the values of everything in this equation (including the total value of the p function) except n,. How do i get matlab to calculate what n is?
Thank you dearly in advance, Karen

 Respuesta aceptada

Jeff Miller
Jeff Miller el 22 de Ag. de 2018
syms p n m b d t
eqn = p == ((n-m)*((1/b)-(1/d)+ ((n-m)*t)/(n*b*d)));
solve_for_n = solve(eqn,n)
% Specify your known values here
m = 3;
b = 2;
d = 1;
t = 2;
p = 12;
the_n_is = vpa(subs(solve_for_n))

1 comentario

Karen Lahav-Yacouel
Karen Lahav-Yacouel el 22 de Ag. de 2018
That s great. Thank you so much for your help! Def learned from your answer. Thank you!!!

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by