MatLab symbolic system of equations using solve function -
i have 3 equations , 3 unknowns lot of other variables. want analytical equations these 3 unknowns. tried solve, pc keeps on working without giving out result. tried solve when symbols left tilt,pan,t , of others numbers, didn't work. tried use fsolve. if put in variables , did work, need symbolic formula tilt,pan. solve code used didn't work:
syms xt yt zt v t tiltangle panangle radius offsetangle xrotationcentre yrotationcentre zrotationcentre eqn1=xt==v*t*cos(tiltangle)*cos(panangle)+radius*cos(tiltangle)*cos(panangle-offsetangle)+xrotationcentre; eqn2=yt==v*t*cos(tiltangle)*sin(panangle)+radius*sin(panangle-offsetangle)+yrotationcentre; eqn3=zt==v*t*sin(tiltangle)-g*t^2/2+radius*sin(tiltangle)*cos(offsetangle)+zrotationcentre solve(eqn1,eqn2,eqn3,tiltangle,panangle,t)
fsolve code used worked:
function f=eqns(x) zt=0.139; yt=0.118; xt=2.18; g=9.81 v=50000/3600 xshootingpoint=-0.105 yshootingpoint=-0.395 zshootingpoint=-0.235 xrotationcentre=-0.33 yrotationcentre=-0.05 zrotationcentre=-0.235 radius=sqrt((xshootingpoint-xrotationcentre)^2+(yshootingpoint-yrotationcentre)^2+(zshootingpoint-zrotationcentre)^2) distancebetween2points=sqrt((xshootingpoint-radius-xrotationcentre)^2+(yshootingpoint-yrotationcentre)^2+(zshootingpoint-zrotationcentre)^2) offsetangle=acos((2*radius^2-distancebetween2points^2)/(2*radius^2)) tilt=x(1) pan=x(2) t=x(3) f(1)=xt-(radius*cos(tilt)*cos(pan-offsetangle)+xrotationcentre)-v*t*cos(tilt)*cos(pan); f(2)=yt-(radius*sin(pan-offsetangle)+yrotationcentre)-v*t*cos(tilt)*sin(pan); f(3)=zt-(radius*sin(tilt)*cos(offsetangle)+zrotationcentre)-v*t*sin(tilt)+g*t^2/2; end
seems have similar problem solving symbolic system of equations in matlab using solve() function
Comments
Post a Comment