Symbolic rewritten in matlab

1 view (last 30 days)
%I tried this, plug alpha and beta with the expressions
syms r t p p0 t0
r=solve(eqn,[t, p, p0 t0])
%It doesn't give what I want
Hello, I have a equation, p0= above
I want to rewrite it as r=something
how can I do this in MATLAB or any other website?
  1 Comment
Walter Roberson
Walter Roberson on 21 Jun 2022
You cannot solve one equation for four variables. You should be trying
solve(eqn, r)

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 21 Jun 2022
An analytic solution is likely not possible, due to the nature of the expression.
The only option is to solve it numerically for ‘r’ given appropriate values for the other variables —
syms p p0 r t0 t
Eqn = p0 == p*(exp(-alpha*t)-exp(-beta*t))/(exp(-alpha*t0)-exp(-beta*t0))
Eqn = 
p0fcn = matlabFunction(rhs(Eqn)-p0)
p0fcn = function_handle with value:
p = rand;
p0 = rand;
t = rand;
t0 = rand;
r = fsolve(@(r)p0fcn(p,p0,r,t,t0), rand)
No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance.
r = -0.0174

More Answers (0)




Community Treasure Hunt

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

Start Hunting!