Solve Non-linear system - System possible but undetermined
1 view (last 30 days)
Show older comments
Hello,
I have this code to solve:
syms Theta_1 Theta_2 Theta_3
l1 = 3
l2 = 2.2
l3 = 1
a = 2
b = 0.5
t = 1
while t<70
phi_1 = (l1*cos(Theta_1)) + (l2*cos(Theta_2)) + (l3*cos(Theta_3)) - a; %Equation 1
phi_2 = (l1*sin(Theta_1)) + (l2*sin(Theta_2)) + (l3*sin(Theta_3)) - b; %Equation 2
phi_3 = Theta_3 - sin(0.05*pi*t); %Equation 3
phi = [phi_1 phi_2 phi_3];
Theta = [Theta_1 Theta_2 Theta_3];
[theta_1 theta_2 theta_3] = solve(phi,Theta); % SOLVING THE EQUATION
%Solving
Num_theta_1 = vpa(theta_1(2)); %positin Bar 1
Num_theta_2 = vpa(theta_2(2)); %positin Bar 2
Num_theta_3 = vpa(theta_3(2)); %positin Bar 3
%Answers
Answer_Position_Theta_1(t) = Num_theta_1;
Answer_Position_Theta_2(t) = Num_theta_2;
Answer_Position_Theta_3(t) = Num_theta_3;
t = t+1
end
figure(1)
plot(Answer_Position_Theta_3,'-*r')
figure(2)
plot(Answer_Position_Theta_2,'-*r')
figure(3)
plot(Answer_Position_Theta_1,'-*r')
When I run the simulation, I get the following result: 1. Theta_1
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193849/image.png)
1. Theta_2
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193850/image.png)
1. Theta_3
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193851/image.png)
We can see that Theta_3 is correct! The function Sine. But Theta_1 and Theta_2 have some point out of the way. Probably is is because cos(30) = con(-30). I need to define that point following the other points.
Do you know how could I do? What should I change?
Dank! Cheers!
0 Comments
Answers (0)
See Also
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!