How to solve parametric system of vector equations?

조회 수: 4 (최근 30일)
Dániel Széplaki
Dániel Széplaki 2020년 3월 21일
댓글: Christopher Creutzig 2020년 3월 25일
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
Christopher Creutzig
Christopher Creutzig 2020년 3월 25일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

David Goodmanson
David Goodmanson 2020년 3월 22일
편집: David Goodmanson 2020년 3월 22일
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
Dániel Széplaki
Dániel Széplaki 2020년 3월 22일
편집: Dániel Széplaki 2020년 3월 22일
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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by