How to solve parametric system of vector equations?

4 visualizaciones (últimos 30 días)
I have two parameters: P1 and P2, they are vectors. I am looking for a C vector and r scalar.
I have constraints: (P1-C)^2 == (P2-C)^2 == r^2 ; (C-(P1+P2)/2)*(P1-P2) == 0 ; 1+r^2 == C^2
Now I have tried creating symbolic variables, such as a, b and then P1 = (a,b). But somehow the dot product of two vectors becomes some complex vector.
So the question is, can I solve a system of equations such as this, using vectors?
  1 comentario
Christopher Creutzig
Christopher Creutzig el 25 de Mzo. de 2020
If you do not say differently, symbolic variables are complex (and scalar). The dot product therefore follows the rules in the complex plane. Please try syms a b real, and if you still run into problems, please post a minimal, but complete code snippet, i.e., something others can copy and run.

Iniciar sesión para comentar.

Respuesta aceptada

David Goodmanson
David Goodmanson el 22 de Mzo. de 2020
Editada: David Goodmanson el 22 de Mzo. de 2020
Hi Daniel,
interesting problem. does this correspond to a particular physical situation?
% P1 --> a, P2 --> b
% solution is for c^2 = r^2 + z^2
a = 2*rand(3,1)-1;
b = 2*rand(3,1)-1;
z = 1; % specific case
p = (a+b)/2;
q = (b-a)/2;
u = cross(p,q); % perpendicular to plane defined by a and b
w = cross(u,q);
w = w/norm(w); % unit vector in ab plane, perpendicular to (b-a)
lambda = (dot(q,q)+z^2-dot(p,p))/(2*dot(p,w));
c = p+lambda*w;
r = sqrt(dot(q,q)+lambda^2);
% checks, should be small
dot(c-a,c-a) - r^2
dot(c-b,c-b) - r^2
dot(c -((a+b)/2),b-a)
dot(c,c) - (r^2+z^2)
  1 comentario
Dániel Széplaki
Dániel Széplaki el 22 de Mzo. de 2020
Editada: Dániel Széplaki el 22 de Mzo. de 2020
It corresponds to a geometric problem. You are given two points inside a unit circle, and you have to find a another circle, that fits on those points, and is perpendicular to the first circle.
I see how your answer works now. Very elegant, thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by