Solving an equation where 2 variables are dependant through a table

1 Ansicht (letzte 30 Tage)
Hi. I have a simple equation: rho = M/ V/ (1-P*k)
M, V and k are known constants.
neither rho nor P are known but rho is a function of P, and there's a table where for each value of P a coresponding value of rho is specified.
how do I find the P and rho that solve the eqaution?
Thanks

Akzeptierte Antwort

Matt J
Matt J am 5 Dez. 2021
Bearbeitet: Matt J am 5 Dez. 2021
If T is your table,
rho=@(Pq) interp1(T.P,T.rho,Pq);
P=fminsearch(@(P) norm( rho(P) - M/ V/ (1-P*k) ), P0 ) ;
rho=rho(P)

Weitere Antworten (0)

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by