Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Correlation and Trend Analysis | Data Analysis for Engineers
Python for Engineers

bookCorrelation and Trend Analysis

メニューを表示するにはスワイプしてください

Understanding the relationship between two variables is a key part of engineering analysis. Correlation is a statistical measure that describes how closely two variables move together. For example, in many engineering systems, you might want to know if there is a relationship between temperature and pressure readings in a closed vessel. If temperature increases, does pressure also increase? Quantifying this relationship helps you make informed decisions and diagnose system behavior.

12345678910
import numpy as np # Example temperature (in Celsius) and pressure (in kPa) readings from a system temperature = [20, 22, 25, 27, 30, 32, 35] pressure = [101, 104, 108, 110, 115, 118, 121] # Calculate the Pearson correlation coefficient corr_matrix = np.corrcoef(temperature, pressure) correlation_coefficient = corr_matrix[0, 1] print(f"Correlation coefficient: {correlation_coefficient:.2f}")
copy

The output from the previous calculation gives you a correlation coefficient, which always ranges from -1 to 1. A value close to 1 means a strong positive relationship: as temperature increases, pressure tends to increase as well. If the coefficient is close to -1, it indicates a strong negative relationship: as one variable increases, the other decreases. A coefficient near 0 means there is little or no linear relationship between the variables. In the temperature and pressure example, a coefficient near 1 suggests that increases in temperature are closely linked to increases in pressure, which is consistent with the behavior of gases in closed systems.

1234567891011
import matplotlib.pyplot as plt temperature = [20, 22, 25, 27, 30, 32, 35] pressure = [101, 104, 108, 110, 115, 118, 121] plt.scatter(temperature, pressure, color="blue") plt.title("Temperature vs. Pressure") plt.xlabel("Temperature (°C)") plt.ylabel("Pressure (kPa)") plt.grid(True) plt.show()
copy

1. What does a correlation coefficient close to 1 indicate?

2. How can engineers use correlation analysis in system diagnostics?

3. Which numpy function computes the correlation coefficient?

question mark

What does a correlation coefficient close to 1 indicate?

正しい答えを選んでください

question mark

How can engineers use correlation analysis in system diagnostics?

正しい答えを選んでください

question mark

Which numpy function computes the correlation coefficient?

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  6

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 1.  6
some-alt