Hello, i have this question.
I am using this code:
syms t1 t2 x1 x2 v1 v2 positive [t1,t2,v1,v2,x1,x2]=solve(T == t1+t2,a == x0+x1+x2, t1 == (-v0+sqrt(v0^2+2*brake*(-x1)))/(-brake), v1 == v0-brake*t1, t2 == (-v1+sqrt(v1^2-2*acc*(-x2)))/acc, v2 == v1+acc*t2, t1,t2,v1,v2,x1,x2);
T,a,v0, accel and brake are values that i already know.
Sometimes this equations cant be solved, so MATLAB gives me "empty syms" as solution. What i want is, when there is no solution and MATLAB gives me the empty syms, assign 0 to this values. I want to do something like:
if(t1=="empty sym")t1=0;end
But i dont find anything to check if t1="empty sym". If anyone could help me I would appreciate that. Thank you very much.
Best Answer