Solving equations in Matlab
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Systems of Nonlinear Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!