syms x y t
0<=t & t<=1;
eqns = [x^2 + y^2 -1 == 0, x - t*cos(0)==0, y - t*sin(0)==0];
vars = [x y];
[solv, solu] = solve(eqns, vars)
This is what I get:
solv =
Empty sym: 0-by-1
solu =
Empty sym: 0-by-1
With that code, I want to know the point of intersection between the circumference and the segment line. I hope someone can help me.

댓글 수: 3

Rik
Rik 2018년 8월 7일
편집: Rik 2018년 8월 7일
In addition to what Star Strider and Walter commented, are you sure you mean assume(0<=t&t<=1) and not assume(0 >=t&t<=1)? Because the former is equivalent to assume(t<=1) and allows the solution [x,y,t]=[-1,0,-1] as well.
John Medina
John Medina 2018년 8월 7일
The segment line goes from (0,0) to (1,0) with direction (1,0) equivalent to angle = 0 (radian). So, t (the parameter) must go from 0 to 1. Forgive for my grammar.
Rik
Rik 2018년 8월 7일
Then you should indeed use assume(0 >=t&t<=1).

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

답변 (2개)

Star Strider
Star Strider 2018년 8월 7일

0 개 추천

First, MATLAB parses matrices differently than you would expect it to, so your original ‘eqns’ system is (as MATLAB reads it) is:
eqns =
[ x^2 + y^2, 0, x - t == 0, y == 0]
Second, you need to be a bit less restrictive with respect to what you request of solve:
syms x y t
assume(0<=t & t<=1)
eqns = [x^2+y^2-1==0, x-t*cos(0)==0, y-t*sin(0)==0];
s = solve(eqns)
ts = s.t
xs = s.x
ys = s.y
ts =
1
xs =
1
ys =
0
It cannot solve for both ‘x’ and ‘y’ simultaneously in the system you posted.

댓글 수: 2

John Medina
John Medina 2018년 8월 7일
Thanks!
Star Strider
Star Strider 2018년 8월 7일
My pleasure!

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

Walter Roberson
Walter Roberson 2018년 8월 7일

0 개 추천

syms x y t
assume(0<=t & t<=1);
eqns = [x^2 + y^2 - 1 == 0, x - t*cos(0)==0, y - t*sin(0)==0]; %notice spacing change
vars = [x y];
sol = solve(eqns);
sol2 = subs(vars, sol);
solv = sol2(:,1);
solu = sol2(:,2);

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2017a

태그

질문:

2018년 8월 7일

댓글:

Rik
2018년 8월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by