How to calculate the equation with letters and 2 variables to get just one solution
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear everyone,
I want to calculate an equation with letter and variable.
Now I can get the variable value presented with the letters I used
but I don't know how to change the letters as real numbers.
this is the example
syms x0 y0 x1 y1 x2 y2 a b p q d positive;
[x0 y0] = solve('(x-p)^2+(y-q)^2=d^2','(p-a)*(y-b)=(x-a)*(q-b)')
then I can get the result
but the problem is how to enter the real number value of letters like
a = 1;
b = 2;
p = 3;
q = 4;
d = 5;
then how to get the only one solution for this two equation ???
답변 (1개)
Walter Roberson
2017년 5월 10일
syms x y a b p q d positive;
sol = solve((x-p)^2+(y-q)^2==d^2, (p-a)*(y-b)==(x-a)*(q-b), 'returnconditions', true);
a = 1;
b = 2;
p = 3;
q = 4;
d = 5;
condition_information = arrayfun(@(C) solve(C,sol.parameters, 'returnconditions', true), subs(sol.conditions));
acceptable_solutions = ~cellfun(@isempty, {ttt.conditions});
x = subs(sol.x(acceptable_solutions));
y = subs(sol.y(acceptable_solutions));
Note: the code can be shorter if you do not mind nasty long warning messages...
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!