Find unknown from the equation with given values
Show older comments
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
Answers (1)
John D'Errico
on 26 May 2018
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.
1 Comment
MUHAMMAD AZFAR BIN ISMAIL
on 26 May 2018
Categories
Find more on Assumptions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!