MATLAB: Solve systems of linear equation in for loop

for loopiterationMATLABsolve

I want to solve a system of 3 equations, all of which are in a for loop. Is there any way to solve for [dx, dy, dt] 180 times and get all of those values?
syms dx dy dt
ax = 0;
ay = 0;
az = -9.8;
u = 16;
phi = 0;
h1 = 60.96;
h2 = 0;
dz = h1 - h2;
for theta = 1:180;
u_x(theta) = u*cosd(theta)*cosd(phi);
u_y(theta) = u*sind(theta)*cosd(phi);
u_z(theta) = u*sind(phi);
f1 = dx(theta) == u_x(theta)*dt + 0.5*ax*dt^2;
f2 = dy(theta) == u_y(theta)*dt + 0.5*ay*dt^2;
f3 = dz(theta) == -u_z(theta)*dt + 0.5*az*dt^2;
[dx, dy, dt] = solve([f1, f2, f3], [dx, dy, dt]);
end

Best Answer

ax = 0;
ay = 0;
az = -9.8;
u = 16;
phi = 0;
h1 = 60.96;
h2 = 0;
dz = h1 - h2;
theta = 1:1:180;
u_x = u*sind(theta)*cosd(phi);
u_y = u*sind(theta)*cosd(phi);
u_z = u*sind(phi);
dt = u_z/az + sqrt(u_z.^2+2*dz*az)/az; (or dt = u_z/az - sqrt(u_z.^2+2*dz*az)/az;)
dx = u_x.*dt + 0.5*ax*dt.^2;
dy = u_y.*dt + 0.5*ay*dt.^2;
Best wishes
Torsten.