Solving a symbolic equation for a vector
조회 수: 4 (최근 30일)
이전 댓글 표시
I need the values of r for different t values, this is how I tried to do it:
syms r
syms t
eq = r^2 == r^2*cos(t)^2 + ((283*r^2*cos(t)^2)/50 + (3481*r*cos(t))/2500)^2;
thetas = [0: pi/20: pi/2];
eq1 = subs(eq, t, thetas);
R = solve(eq1, r)
댓글 수: 0
채택된 답변
Paul
2022년 4월 23일
For each value of theta, there are four solutions, two of which are the trivial zero solution. All solutions can be saved in a cell array and then you can figure out which ones to keep. Or you can choose the solutions you want inside the loop.
syms r
syms t
eq = r^2 == r^2*cos(t)^2 + ((283*r^2*cos(t)^2)/50 + (3481*r*cos(t))/2500)^2;
thetas = sym(pi)*[0: 1/20: 1/2];
for ii = 1:numel(thetas)
R{ii} = solve(subs(eq,t,thetas(ii)),r);
end
% for example
R{2}
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
