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

조회 수: 4 (최근 30일)
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

채택된 답변

bym
bym 2012년 7월 9일
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

추가 답변 (1개)

Chris
Chris 2012년 7월 11일
Thanks mucho!

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by