简体   繁体   English

如何在Excel中计算2个坡度相交的角度

[英]How to calculate the angle at which 2 slopes cross in excel

I want to calculate the angle at which two lines are crossing, where the angle should be expressed as a positive when green1 < blue1 and green2 > blue1. 我想计算两条线相交的角度,当green1 <blue1和green2> blue1时,该角度应表示为正。

Does anyone know how to do this in excel? 有谁知道如何在excel中做到这一点?

Period  Green   Blue
   1   210.99   212.99
   2   212.63   211.32

在此处输入图片说明

The formula you have calculates the angle between the slope and x-axis for a single line. 您拥有的公式可计算出一条直线的斜率与x轴之间的角度。 You actually need to calculate the angle for both slopes and then take the difference between them. 实际上,您需要计算两个斜率的角度,然后取它们之间的差。 Since you want Green > Blue to be positive, you need to subtract the Slope of Blue from the Slope of Green. 由于您希望绿色>蓝色为正,因此需要从绿色斜率中减去蓝色斜率。

That said, slope really requires defined values on the x-axis. 也就是说,斜率确实需要在x轴上定义值。 You've only got values on the y-axis, which gives no bearing for the changes in y-axis. 您在y轴上只有值,这与y轴的变化无关。 If you have values for the x-axis (representing changes in time or position or anything for the different values of green and blue) you should put those in your table. 如果您有x轴的值(代表时间或位置的变化,或者代表绿色和蓝色的不同值的任何值),则应将其放在表中。 You should then plot the points using a scatter chart to input x and y values, and then format the table so that the 1 unit on each axis is the same length in the table. 然后,应使用散点图绘制点以输入x和y值,然后格式化表格,以使每个轴上的1单位在表格中的长度相同。

In your example, for lack of an axis and just using the difference between x-values as 1, you just need: 在您的示例中,由于缺少轴,仅将x值之间的差值用作1,您只需要:

=DEGREES(ATAN(change of green))) - DEGREES(ATAN(change of blue))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM