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

 采纳的回答

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 个评论

That s great. Thank you so much for your help! Def learned from your answer. Thank you!!!

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息

产品

版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by