Writing an equation in terms of specific variables where relationship is known.

So I am trying to specify what an equation is written in terms of, below is a simple example i have concoted.
Since i know r's relationship to t I could write F in terms of r or t. Is there a way of asking matlab to write a function in terms of specific variables? In this case I would want F in terms of m,a,b and r not t for example.
clear all
syms m a b t
r = a*b*t^2
r = 
F = m * diff(r,t)
F = 

 Akzeptierte Antwort

syms m a b t r
t_eq = solve(r - a*b*t^2==0,t);
r = a*b*t^2;
F = m * diff(r,t);
F = subs(F,t,t_eq)

3 Kommentare

Thank you for this solution it work. Just out of curiousity however, if there was a more complex situation with even more variables, is there a way to specifically request MATLAB what variables I want my equation to be in terms of?
Torsten
Torsten am 27 Dez. 2021
Bearbeitet: Torsten am 27 Dez. 2021
I doubt it.
I think you will have to solve for the variable(s) you don't want the equation to be in terms of and afterwards substitute the corresponding expressions (only depending on the variables you want the equation to be in terms of) into the equation.
But someone might correct me here.
Jack
Jack am 27 Dez. 2021
Bearbeitet: Jack am 27 Dez. 2021
Thank you very much kind internet person

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021b

Tags

Gefragt:

am 27 Dez. 2021

Bearbeitet:

am 27 Dez. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by