Find unknown from the equation with given values
显示 更早的评论
I'm try to find the value of an unknown from an equation.
for simplicity sake,
values of a = [1;2;3;4]
a = b + 1
how do i find values of b for each values of a?
thank you so much in advance
回答(1 个)
John D'Errico
2018-5-26
b=a-1;
WTP?
Since your real problem is apparently more complex than grade school mathematics, use solve.
syms a b
b = solve(a == b + 1,b)
b =
a - 1
b = double(subs(b,a,1:4))
b =
0 1 2 3
Or if you don't have the symbolic TB, use fzero, in a loop, solving for one element at a time.
类别
在 帮助中心 和 File Exchange 中查找有关 Assumptions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!