Using solve command, to solve user defined function

17 Ansichten (letzte 30 Tage)
Roohullah Ansari
Roohullah Ansari am 17 Feb. 2022
Beantwortet: Prateek Rai am 21 Feb. 2022
Suppose I write a function f(a,b,c,d).
I want to solve it using solve as
solve(b=1/f(a,b,c,d))
but whenever i used the above it gives error, showing use symb variable.
  1 Kommentar
Torsten
Torsten am 17 Feb. 2022
You defined a,b,c and d as symbolic ? You want to solve b=1/f(a,b,c,d) for b ?
Then
bsol = solve(b*f(a,b,c,d)==1,b)
should work.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Prateek Rai
Prateek Rai am 21 Feb. 2022
Hi,
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:
solve(b==1/f(a,b,c,d))
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.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by