Created
March 4, 2016 09:13
-
-
Save reox/f148f898f342d75d7fa7 to your computer and use it in GitHub Desktop.
Kreissegment Verhalten von Sehnenlänge und Segmenthöhe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
radius <- function(h, s){ | |
# Abbruchbedingung | |
h <- ifelse(h > s/2, NaN, h) | |
n <- ((4 * h^2) + s^2) / (8 * h) | |
return( n ) | |
} | |
library(ggplot2) | |
p <-ggplot(data.frame(x = c(0.0, 20)), aes(x)) | |
plot( | |
p + stat_function(fun=radius, aes(color="10"), args=list(s=10), n = 100000) | |
+ stat_function(fun=radius, aes(color="20"), args=list(s=20), n = 100000) | |
+ stat_function(fun=radius, aes(color="30"), args=list(s=30), n = 10000) | |
+ stat_function(fun=radius, aes(color="40"), args=list(s=40), n = 10000) | |
+ scale_y_continuous(limits = c(0, 200)) | |
+ ylab("Radius [mm]") | |
+ xlab("Height of Segment [mm]") | |
+ guides(color=guide_legend(title="Kreissehne [mm]")) | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For what is it?
I want to build a device to measure the radius of a surface by using the circular segment formular. Two pins in the distance of
s
and a moveable center pin will be put on the surface. while the to pins in distances
are fixed, the center will move the distanceh
. With this formular you can calculate the radius.It is nice to see, that for large radii, a very small measuring error produce a much different radius. but for a radius in the range of
2*s
, it is quite easy to measure it (even if the accuracy is small)