Is there an error in the if else statement?
Show older comments
when I try to enter the code the system does not run, it all happened when I added the if else statment so whats wrong?
>> % Known Variables:
L1 = 16.87; %cm
L2 = 60.35;
L3 = 16.81;
L4 = 63.06;
L5 = 42.62;
L7 = 19.64;
theta_1 = 105.47; %degree
theta_3 = 270;
theta_5 = 115.38;
theta_triangle = ;
v = 2.95;
for t = 0 : 0.1 : 10;
LA= 29.71+ v*t;
%solving for theta 6(actuator) and theta7
Z = L5*exp(i*deg2rad(theta_5));
Zc = conj(Z);
A = L7*Zc;
B = Z*Zc +L7^2 -LA.^2;
C = L7*Z;
Q = (-B - sqrt(B^2 -4*A*C))/2*A;
Q_1 = (-B+ sqrt(B^2 -4*A*C))/2*A;
W= ((L7*Q)+Z)/LA;
W_1 = ((L7*Q_1)+Z)/LA;
theta_7 = rad2deg(angle(Q));
theta_7_1_ = rad2deg(angle(Q_1));
theta_6 = rad2deg(angle(W));
theta_6_1 = rad2deg(angle(W_1));
if theta_7>90
theta_7_Final =360-theta_7;
else if theta_7>-180
theta_7_Final =180-theta_7_1;
else theta_7_Final =180-theta_7_1;
theta_6_Final = 180+theta_6_1
theta_4_Final= theta_7_Final - theta_triangle
end
Accepted Answer
More Answers (0)
Categories
Find more on Measurements and Spatial Audio in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!