You can define the function cv
with inputs t1
and t2
in MATLAB like this:
main.m49 chars4 lines
Then, to solve for t1
when cv
is equal to 100, you can use the solve
function like this:
main.m97 chars6 lines
This creates a symbolic variable t1
, sets t2
to a value of 2, evaluates cv
using f(t1, t2)
, creates an equation eqn
to solve (cv == 100
), and then solves for t1
using solve(eqn, t1)
. The output sol_t1
is a symbolic expression for t1
that makes cv
equal to 100.
Note that the solve
function only works with symbolic equations, so you need to use the syms
command to create symbolic variables. Also, if your function f
is not already defined, you will need to fill in the "your code here" section with the actual formula for cv
.
gistlibby LogSnag