7
7
RPM = np .array ([30 , 36 , 39.8 , 43.3 , 45.8 , 50.5 , 55.2 , 55.6 , 58.5 , 62.5 , 66.5 , 70.5 , 74.5 , 76.8 , 80 , 85 , 88.2 , 90.5 , 96 , 99.2 , 102.1 ])
8
8
9
9
# Additional points
10
- datacheet_values_V = np .array ([6 , 7.4 ])
11
- datacheet_values_RPM = np .array ([55.6 , 62.5 ])
10
+ datasheet_values_V = np .array ([6 , 7.4 ])
11
+ datasheet_values_RPM = np .array ([55.6 , 62.5 ])
12
12
13
13
# Linear regression function
14
14
def linear_model (x , a , b ):
@@ -27,7 +27,7 @@ def linear_model(x, a, b):
27
27
28
28
# Calculate the linear regression model shift applied to datasheet values
29
29
# Compute the average vertical shift between the new points and the initial regression
30
- shifts = datacheet_values_RPM - linear_model (datacheet_values_V , a , b )
30
+ shifts = datasheet_values_RPM - linear_model (datasheet_values_V , a , b )
31
31
average_shift = np .mean (shifts )
32
32
33
33
# New intercept for the parallel line
@@ -37,7 +37,7 @@ def linear_model(x, a, b):
37
37
# Plot the data
38
38
plt .figure (figsize = (10 , 7 ))
39
39
plt .scatter (V , RPM , color = "blue" , label = "Measures" )
40
- plt .scatter (datacheet_values_V , datacheet_values_RPM , color = "green" , label = "Datacheet values" , marker = 'x' , s = 100 )
40
+ plt .scatter (datasheet_values_V , datasheet_values_RPM , color = "green" , label = "Datasheet values" , marker = 'x' , s = 100 )
41
41
plt .plot (V_fit , RPM_fit , color = "red" , label = f"Linear regression: RPM = { a :.2f} * V + { b :.2f} " )
42
42
plt .plot (V_fit , RPM_parallel_fit , color = "orange" , linestyle = "--" , label = "Linear regression model applied to datasheet values" )
43
43
0 commit comments