How to do code with 2 equations with 2 unknowns and an angle that goes from 0 to 360?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Image Analyst
2021 年 5 月 21 日
megan, or Amjad, somehow your edit to your name and message blew away your question. So I'm putting it back below.
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.
回答 (1 件)
Image Analyst
2021 年 5 月 11 日
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 件のコメント
Image Analyst
2021 年 5 月 12 日
Do you mean x vs. z for a constant Y value? Or a family of curves for several y values? What is the range of x and y?
Image Analyst
2021 年 5 月 13 日
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.
参考
カテゴリ
Help Center および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!