How to solve symbolic function

I want to solve t:
eq=(ap^2*t^3)/2 - ap*t^3 + (ap*t^2)/2 - t^3/2 + t^2/2 + (127*t)/8 - 8
assume(1>ap>0)
sol=solve(eq==0,t,"ReturnConditions",true)
But I got this result:
[root(4*ap^2*z^3 - 8*ap*z^3 - 4*z^3 + 4*ap*z^2 + 4*z^2 + 127*z - 64, z, 1); root(4*ap^2*z^3 - 8*ap*z^3 - 4*z^3 + 4*ap*z^2 + 4*z^2 + 127*z - 64, z, 2); root(4*ap^2*z^3 - 8*ap*z^3 - 4*z^3 + 4*ap*z^2 + 4*z^2 + 127*z - 64, z, 3)]
ans =
Empty sym: 1-by-0
I want to get the result like t(ap)=...
Could you please give me some teaching to help me to solve this problem? Thanks a lot.

Réponses (1)

syms t ap
eq=(ap^2*t^3)/2 - ap*t^3 + (ap*t^2)/2 - t^3/2 + t^2/2 + (127*t)/8 - 8
eq = 
sol=solve(eq==0,'ReturnConditions',true,'MaxDegree',3)
sol = struct with fields:
t: [3×1 sym] parameters: [1×0 sym] conditions: [3×1 sym]
sol.t
ans = 
sol.conditions
ans = 

Catégories

En savoir plus sur Parallel Computing dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by