# How to do code with 2 equations with 2 unknowns and an angle that goes from 0 to 360?

4 views (last 30 days)
megan on 11 May 2021
Commented: Rena Berman on 29 Jun 2021 at 15:11
A sin x - B sin y + Csin z = 0
B cos y - C cos z - A cos x + H= 0
A, B, C, & H are known values.
z : it is going full rev (0 to 360 degrees)
I want to find y and x.
##### 2 CommentsShowHide 1 older comment
Rena Berman on 29 Jun 2021 at 15:11

Image Analyst on 11 May 2021
It would be easier if you told us A, B, C, and H, and the range that x and y take. Then just loop over z. It might be easier if you just plot and visualize the equations first. Then you can see what index they are closest to zero and get the x and y value from that index. Please provide code such as
% A = whatever; % Same for B, C, H
A = 2;
B = 1.5;
C = 1.3;
H = 0.3;
numPoints = 300;
x = linspace(-16*pi, 16*pi, numPoints);
y = linspace(-16*pi, 16*pi, numPoints);
numAngles = 16; % or 360 or however many you want.
allz = linspace(0, 360, numAngles)
for k = 1 : length(allz)
nexttile;
z = allz(k);
eq1 = A * sind(x) - B * sind(y) + C * sind(z);
plot(eq1, 'b-', 'LineWidth', 2);
hold on;
eq2 = B * cosd(y) - C * cosd(z) - A * cosd(x) + H;
plot(eq2, 'r-', 'LineWidth', 2);
caption = sprintf('Graph for angle %.1f', z);
title(caption, 'FontSize', 12);
xlabel('Index', 'FontSize', 12);
grid on;
yline(0, 'Color', 'k', 'LineWidth', 2);
drawnow;
end
##### 2 CommentsShowHide 1 older comment
Image Analyst on 13 May 2021
So are x and y the lateral distance of the two arm tips, so, like for the 8 inch long arm:
xx = 8 * cosd(z)
xy = 8 * sind(z);
and for the other 13 inch long arm
yx = 13 * cosd(z)
yy = 13 * sind(z);
What exactly do the two equations mean or represent? Like the distance between the arm tips or something?
It looks like for a given z, thetax and thetay are different angles so they are out of phase with each other. We'd need to know the phase difference to determine the two thetas.