Solving equations in Matlab
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Torsten
le 11 Juin 2015
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 commentaires
Voir également
Catégories
En savoir plus sur Mathematics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!