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!