Solve f(x) with mex files

1 view (last 30 days)
Matthias Stark
Matthias Stark on 23 Nov 2015
Commented: Matthias Stark on 23 Nov 2015
Hello together,
i have the following problem.
An Matlab add-in gives me (via mex files) the possibility to generate Steam-Properties
e.g. function xs_ph_97(p,h) gave me the xs value of the steam.
So i have the following problem:
The i need to solve the function F(x) = (xs_ph_97(x,h) == 0,5).
When i create a script with
syms f(x)
f(x) = (xs_ph_97(x,h) == 0,5)
I get following error:
!x_ph_97: unreasonable type or size of argument 1!
Can somebody help me
Best regards

Answers (1)

Walter Roberson
Walter Roberson on 23 Nov 2015
h = some appropriate value
x0 = initial value of x to check
Fx = fzero(@(x) xs_ph_97(x,h) - 0.5, x0);
This is not a function because there is a single x solution (or one solution for each h value): Fx will be the x that solves xs_ph_97(x,x) == 0.5
  1 Comment
Matthias Stark
Matthias Stark on 23 Nov 2015
Thank you very much, the solver is working now Best regards

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!