How can I specify a parameter to solve a system of equations symbolically?
1 次查看(过去 30 天)
显示 更早的评论
I have defined a variable for time (t), velocity (v) and postion (p):
syms v_0 t_1 v_1 p_1
Now a define a system of equations to calculate the position and speed at time t_1 depending on the initial speed v_0:
eqns_1 = [ ...
t_1 == 1.0, ...
v_1 == v_0, ...
p_1 == v_0 * t_1, ...
]
As a result I would expect:
struct with fields:
t_1: 2
v_1: v_0
p_1: 2*v_0
I tried
solution_1 = solve(eqns_1)
and
solution_2 = solve(eqns_1,'ReturnConditions',true)
which both deliver
struct with fields:
t_1: 1
v_0: p_1
v_1: p_1
So how can I specify that v_0 is my parameter and not p_1?
0 个评论
采纳的回答
Torsten
2022-8-30
syms v_0 t_1 v_1 p_1
eqns_1 = [ ...
t_1 == 2.0, ...
v_1 == v_0, ...
p_1 == v_0 * t_1, ...
];
solve(eqns_1,[t_1,v_1,p_1])
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!