Solving a symbolic equation for a vector
7 views (last 30 days)
Show older comments
Hubert Coppieters 't Wallant
on 23 Apr 2022
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 Comments
Accepted Answer
Paul
on 23 Apr 2022
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 Comments
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!