update to local git repo

This commit is contained in:
fzzinchemical
2025-07-02 13:08:03 +02:00
commit 269b8a31ba
136 changed files with 12257 additions and 0 deletions

45
Semester 3/ELMESS/Labor_04.md Executable file
View File

@@ -0,0 +1,45 @@
5.3 Zeitkonstanten, Least Squares Parameteridentifikation
´´´matlab
scss
% Import necessary libraries
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import curve_fit
% Load data from file
data = np.loadtxt('data.csv', delimiter=',')
% Define functions for plotting
def plot_time_series(x, y):
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Temperature (°C)')
ax.grid(True)
return fig, ax
% Define functions for fitting the curves
def fit_curve(x, y, t0, T0, Tb):
A = np.exp(-Tb * x / T0)
B = np.log(1 + (A / (1 - A)))
return A * np.exp(B * x / T0)
def fit_saturation(x, y, t0, T0, Tb):
def saturation(x, t0, T0, Tb):
return T0 + (Tb - T0) * np.exp(-x / t0)
return curve_fit(saturation, x, y, p0=[t0, T0, Tb])[0]
% Fit curves to data
fig1, ax1 = plot_time_series(data[:, 0], data[:, 1])
ax1.plot(fit_curve(data[:, 0], data[:, 1], t0=30, T0=25, Tb=10))
fig2, ax2 = plot_time_series(data[:, 0], data[:, 2])
ax2.plot(fit_saturation(data[:, 0], data[:, 2], t0=30, T0=25, Tb=10))
% Calculate difference between time constants
T_diff = np.abs(fit_curve(data[:, 0], data[:, 2], t0=30, T0=25, Tb=10)[0] - fit_saturation(data[:, 0], data[:, 2], t0=30, T0=25, Tb=10)[0])
% Print result
print('The difference between the time constants of the two sensors is:', T_diff)
´´´
5.4 Parameter B des NTC
EASY STUFF!!!