Solving a symbolic equation for a vector

4 visualizaciones (últimos 30 días)
Hubert Coppieters 't Wallant
Hubert Coppieters 't Wallant el 23 de Abr. de 2022
Respondida: Paul el 23 de Abr. de 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)

Respuesta aceptada

Paul
Paul el 23 de Abr. de 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}
ans = 

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by