how can i solve simultaneous equation using genetic algorithm ?

x = 10*cos(t1) + 5*cos(t1 + t2)
y = 10*sin(t1) + 5*sin(t1+t2)
i have these two equations and i have known outputs x=10 and y=5, how can i solve them keeping in mind that the outputs are unknown and i want to generate them using genetic algorithms.

回答(1 个)

Hi Ahamed
cos(A)=.5*(exp(j*A)+exp(-j*A))
sin(B)=-j*.5*(exp(j*B)-exp(-j*B))
x = 5*(exp(j*t1)+exp(-j*t1)) + 2.5*(exp(j*(t1+t2))+exp(-j*(t1+t2)))
y = -j*5*(exp(j*t1)-exp(-j*t1)) - j*2.5*(exp(j*(t1+t2))-exp(-j*(t1+t2)))
x = 5*exp(j*t1)+5*exp(-j*t1) + 2.5*(exp(j*t1)*exp(j*t2)+exp(-j*t1)*exp(-j*t2))
y = -j*5*(exp(j*t1)-exp(-j*t1)) - j*2.5*(exp(j*t1)*exp(j*t2)-exp(-j*t1)*exp(-j*t2))
now substitution
u=exp(j*t1)
v=exp(j*t2)
x/5 = u+1/u + .5*(u*v+1/(u*v))
y/(-j*5) = u-1/u - .5*(u*v-1/(u*v))
since you claim to have x and y fixed to constant values
k1=x0/5
k2=y0/(-j*5)
can you solve the u v system?
i also had a look at
x = 5*cos(t1) + 5*cos(t1) + 5*cos(t1 + t2)
y = 5*sin(t1) + 5*sin(t1) + 5*sin(t1+t2)
using:
cos(A)+cos(B)=2*cos((A+B)/2)*cos((A-B)/2)
sin(A)+sin(B)=2*sin((A+B)/2)*cos((A-B)/2)
x/5=cos(t1)+2*cos(t1+t2/2)*cos(t2/2)
y/5=sin(t1)+2*sin(t1+t2/2)*cos(t2/2)
and
cos(A+B)=cos(A)*cos(B)-sin(A)*sin(B)
sin(A+B)=sin(A)*cos(B)+cos(A)*sin(B)
but the u v system seems a good start point, doesn't it?
If t1 and t2 ranges are narrow, perhaps you would like to try Taylor (MacLaurin) approximations for cos() and sin() from http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf
If you find this answer of any help solving your question, please click on the thumbs-up vote link,
thanks in advance
John

1 个评论

I have tried the u v method but the code did not work. i would be thankful if u helped me with the code . Thanks in advance .

请先登录,再进行评论。

类别

Community Treasure Hunt

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

Start Hunting!

Translated by