Evaluating an implicit equation, with multiple parameters that can be modified

4 Ansichten (letzte 30 Tage)
Hey all, I'm still learning many MATLAB functions so it's possible this just needs simple answer. Haven't been able to find it on my own though, so any help is greatly appreciated.
I have a function that depends on several parameters. I want to be able to define all but one parameter and then have MATLAB output the remaining parameter value.
More specifically, for instance, if I: (1) have the equation below, (2) want to solve for tm, and (3) have parameters b, tp, & a (that I'd like to ultimately try different values for),
(b^2/6)*((tm-tp)^(-1)-(tm^-1))/(log(tm)-log(tm-tp))-a = 0
what's the best way to define the parameters (b, tp, a) and then get the value of tm?
Right now I only have a really clunky method, below. Which is sort of ok for this, but will not work well when I move on to my next equation, which has more variables and an integral...
...
syms tm
S = solve('(b^2/6)*((tm-tp)^(-1)-(tm^-1))/(log(tm)-log(tm-tp))-a','b=.0015', 'tp=1', 'a=1.47e-7');
S = [S.tm S.tp S.b S.alph];
disp(S(1))
...
Thanks for any helpful ideas! Chris

Akzeptierte Antwort

bym
bym am 9 Jul. 2012
clc;clear
b = .0015;
tp = 1;
a = 1.47e-7;
f = @(tm)(b^2/6)*((tm-tp)^(-1)-(tm^-1))/(log(tm)-log(tm-tp))-a;
tm = fzero(f,2.7);
tm =
3.1152

Weitere Antworten (1)

Chris
Chris am 11 Jul. 2012
Thanks mucho!

Kategorien

Mehr zu MATLAB 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