Using solve command, to solve user defined function

조회 수: 5(최근 30일)
Roohullah Ansari
Roohullah Ansari 2022년 2월 17일
답변: Prateek Rai 2022년 2월 21일
Suppose I write a function f(a,b,c,d).
I want to solve it using solve as
but whenever i used the above it gives error, showing use symb variable.
  댓글 수: 1
Torsten 2022년 2월 17일
You defined a,b,c and d as symbolic ? You want to solve b=1/f(a,b,c,d) for b ?
bsol = solve(b*f(a,b,c,d)==1,b)
should work.

댓글을 달려면 로그인하십시오.


Prateek Rai
Prateek Rai 2022년 2월 21일
You can use "syms" to create symbolic function with four arguments:
syms f(a,b,c,d)
here, f is abstract symbolic function. It does not have symbolic expressions assigned to it.
Then, specify the following formula for f.
% formula for f
After that, you can use "solve" function:
Please refer to syms MathWorks documentation page to find more on creating symbolic functions. You can also refer to solve MathWorks documentation page to learn more about Equations and systems solver.

Community Treasure Hunt

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

Start Hunting!

Translated by