How is it possible that vpasolve gives empty vectors when there are solutions?

3 views (last 30 days)
I have a system of equations containing cosine and sine functions. The unknowns are angles so the range is between 0 and 360 degrees. When I put in these ranges then vpasolve gives back empty vectors when there are solutions. How is it possible that vpasolve does not give back the solutions? And vpasolve gives back the solutions when I narrow the ranges down. But it should find the solutions within a range of at most 90 degrees.
This is my code:
clear; close all; clc
% Given parameters
A = [0 0]; % Coordinates of winch
SlingPos = [2 3;
10 8;
0 26;
22 20;
52 32;]; % Coordinates of the fixed point of the slings
SlingLen = [1;
2;
2.5;
3;
4]; % Length of the slings
Pwr = [0;
0;
0;
0;
0;]; % Percent friction in sheave 1
M = 500; % Mass of load
% Calculate angles and resultant force in the slings
syms(sym('theta',[1 length(SlingLen)])) % Create symbolic variables for the angles theta
syms(sym('T',[1 length(SlingLen)])) % Create symbolic variables for the resultant forces T
syms(sym('phi',[1 length(SlingLen)])) % Create symbolic variables for the angles phi
Fg = M*9.81; % Gravity
Fpull = zeros(length(SlingLen),1);
Fpull(end) = ((100+Pwr(end))/100)*Fg; % Pulling force of the last sheave
% Calculate other pulling forces
for i = length(SlingLen)-1:-1:1
Fpull(i) = ((100+Pwr(i))/100)*Fpull(i+1);
end
%TEST
[phi1, theta1, T1, phi2, theta2, T2, phi3, theta3, T3, phi4, theta4, T4, phi5, theta5, T5] = vpasolve(...
-Fpull(1)*cosd(phi1)-T1*cosd(theta1)+Fpull(2)*cosd(phi2)==0,...
Fpull(1)*sind(phi1)+T1*sind(theta1)-Fpull(2)*sind(phi2)==0,...
-Fpull(2)*cosd(phi2)-T2*cosd(theta2)+Fpull(3)*cosd(phi3)==0,...
Fpull(2)*sind(phi2)+T2*sind(theta2)-Fpull(3)*sind(phi3)==0,...
-Fpull(3)*cosd(phi3)-T3*cosd(theta3)+Fpull(4)*cosd(phi4)==0,...
Fpull(3)*sind(phi3)+T3*sind(theta3)-Fpull(4)*sind(phi4)==0,...
-Fpull(4)*cosd(phi4)-T4*cosd(theta4)+Fpull(5)*cosd(phi5)==0,...
Fpull(4)*sind(phi4)+T4*sind(theta4)-Fpull(5)*sind(phi5)==0,...
-Fpull(5)*cosd(phi5)-T5*cosd(theta5)==0,...
Fpull(5)*sind(phi5)+T5*sind(theta5)-Fg==0,...
A(1,1)+sqrt((abs(A(1,1)-SlingPos(1,1))+SlingLen(1)*cosd(theta1))^2+(abs(A(1,2)-SlingPos(1,2))-SlingLen(1)*sind(theta1))^2)*cosd(phi1)==SlingPos(1,1)+SlingLen(1)*cosd(theta1),...
SlingPos(1,1)+SlingLen(1)*cosd(theta1)+sqrt((abs(SlingPos(1,1)+SlingLen(1)*cosd(theta1)-SlingPos(2,1))+SlingLen(2)*cosd(theta2))^2+(abs(SlingPos(1,2)-SlingLen(1)*sind(theta1)-SlingPos(2,2))-SlingLen(2)*sind(theta2))^2)*cosd(phi2)==SlingPos(2,1)+SlingLen(2)*cosd(theta2),...
SlingPos(2,1)+SlingLen(2)*cosd(theta2)+sqrt((abs(SlingPos(2,1)+SlingLen(2)*cosd(theta2)-SlingPos(3,1))-SlingLen(3)*cosd(theta3))^2+(abs(SlingPos(2,2)-SlingLen(2)*sind(theta2)-SlingPos(3,2))-SlingLen(3)*sind(theta3))^2)*cosd(phi3)==SlingPos(3,1)+SlingLen(3)*cosd(theta3),...
SlingPos(3,1)+SlingLen(3)*cosd(theta3)+sqrt((abs(SlingPos(3,1)+SlingLen(3)*cosd(theta3)-SlingPos(4,1))+SlingLen(4)*cosd(theta4))^2+(abs(SlingPos(3,2)-SlingLen(3)*sind(theta3)-SlingPos(4,2))+SlingLen(4)*sind(theta4))^2)*cosd(phi4)==SlingPos(4,1)+SlingLen(4)*cosd(theta4),...
SlingPos(4,1)+SlingLen(4)*cosd(theta4)+sqrt((abs(SlingPos(4,1)+SlingLen(4)*cosd(theta4)-SlingPos(5,1))+SlingLen(5)*cosd(theta5))^2+(abs(SlingPos(4,2)-SlingLen(4)*sind(theta4)-SlingPos(5,2))-SlingLen(5)*sind(theta5))^2)*cosd(phi5)==SlingPos(5,1)+SlingLen(5)*cosd(theta5),...
[phi1,theta1,T1,phi2,theta2,T2,phi3,theta3,T3,phi4,theta4,T4,phi5,theta5,T5],...
[0 360;0 360;-inf inf;0 360;0 360;-inf inf;0 360;0 360;-inf inf;0 360;0 360;-inf inf;0 360;0 360;-inf inf]);
PosSheave1 = [double(SlingPos(1,1)+SlingLen(1)*cosd(theta1)); double(SlingPos(1,2)-SlingLen(1)*sind(theta1))]
PosSheave2 = [double(SlingPos(2,1)+SlingLen(2)*cosd(theta2)); double(SlingPos(2,2)-SlingLen(2)*sind(theta2))]
PosSheave3 = [double(SlingPos(3,1)+SlingLen(3)*cosd(theta3)); double(SlingPos(3,2)-SlingLen(3)*sind(theta3))]
PosSheave4 = [double(SlingPos(4,1)+SlingLen(4)*cosd(theta4)); double(SlingPos(4,2)-SlingLen(4)*sind(theta4))]
PosSheave5 = [double(SlingPos(5,1)+SlingLen(5)*cosd(theta5)); double(SlingPos(5,2)-SlingLen(5)*sind(theta5))]
  7 Comments
Walter Roberson
Walter Roberson on 23 May 2019
A(1,1)+sqrt((abs(A(1,1)-SlingPos(1,1))+SlingLen(1)*cosd(theta1))^2+(abs(A(1,2)-SlingPos(1,2))-SlingLen(1)*sind(theta1))^2)*cosd(phi1)==SlingPos(1,1)+SlingLen(1)*cosd(theta1),...
^1^ ^1^ ^1^
SlingPos(1,1)+SlingLen(1)*cosd(theta1)+sqrt((abs(SlingPos(1,1)+SlingLen(1)*cosd(theta1)-SlingPos(2,1))+SlingLen(2)*cosd(theta2))^2+(abs(SlingPos(1,2)-SlingLen(1)*sind(theta1)-SlingPos(2,2))-SlingLen(2)*sind(theta2))^2)*cosd(phi2)==SlingPos(2,1)+SlingLen(2)*cosd(theta2),...
^1^ ^1^ ^2^ ^1^ ^2^ ^2^
After the == the first equation uses theta1, the second uses theta2, and so on through theta5.
Before the == the first equation uses theta1, then the second uses theta1, third uses theta2, and so on. The last equation uses theta4, with there being no corresponding equation using theta5.
Perhaps this is to be expected for your situation; it looked a bit asymmetric to me.
Jeroen Staps
Jeroen Staps on 23 May 2019
No that is not the problem, that is to be expected. Because A is the starting point and does not correspond to a angle. From there on SlingPos(1,1) has theta1 SlingPos(2,1) has theta 2 and so on.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 22 May 2019
vpasolve() does a modified newton search.
  • This can involve projecting outside of any given bounds even though the solution is safely within bounds. It is a property of newton type searches that in some cases as the search approaches the correct location it can end up projecting quite a distance away. When vpasolve() passes a boundary, it immediately gives up, and does not attempt to bounce off of the boundary
  • vpasolve() uses the array bounds as the initial points if they are finite. In situations where there might be multiple zero crossings, which is common with trig, then this can result in the initial points having the same sign, causing it to think there is no need to look for a zero crossing
  • because the search is more or less following local gradient, it is possible to get caught in a local minima. In such cases, vpasolve() will give up.

More Answers (0)

Categories

Find more on Equations in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!