필터 지우기
필터 지우기

Solving equations in Matlab

조회 수: 1 (최근 30일)
Srey
Srey 2015년 6월 11일
답변: Torsten 2015년 6월 11일
I have 3 poInts (1,3) (2,1) (1,1 ).
From a point (x0,y0), 3 people are walking to 3 different points (1,3) (2,4) (1,4).Assume constant velocity, time they start is unknown say t0.
time to reach location1=t0-t1
time to reach location2=t0-t2
time to reach location3=t0-t3
x=[1 2 1];
y=[3 4 4];
syms x0 y0 t0
%Distance from x0,y0 to 1,3
D1=sqrt((x(:,1)-x0)^2+(y(:,1)-y0)^2);
%Distance from x0,y0 to 2,1
D2=sqrt((x(:,2)-x0)^2+(y(:,2)-y0)^2);
%Distance from x0,y0 to 1,1
D3=sqrt((x(:,3)-x0)^2+(y(:,3)-y0)^2);
t0-t1=D1/V;
t0-t2=D2/V;
t0-t3=D3/V;
three equations
D1-V(t0-t1)=0
D2-V(t0-t2)=0
D3-V(t0-t3)=0
How will i solve so that I get x0 y0 t0 values ie the starting location and the starting time. Knowns: x1, y1,x2,y2,x3,y3,V,t1,t2,t3 Unknowns:x0,y0,t0
Any one please help me to write the code in Matlab and solve the equations.

답변 (1개)

Torsten
Torsten 2015년 6월 11일
1. First you use (1,3) (2,1) (1,1 ) as the three points, later on (1,3) (2,4) (1,4). Which versionis correct ?
2. I guess that t0 < t1, t0 < t2 and t0 < t3. Thus D1-V(t0-t1)=0 means V < 0 ?
After you have corrected these inconsistencies, try MATLAB's "solve" to solve for t0, x0 and y0.
If you don't succeed to get an analytical solution, use MATLAB's "fsolve".
Best wishes
Torsten.

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by