hey na lüfts
- User
hey na lüfts
- Assistant
Hallo! Mir geht es gut. Wie läuft es bei dir?
- User
ich gebe dir das code und meine werte, kannst du die werte an dem code anpassen 0 23,78 5 29,57 10 35,41 15 40,33 20 44,96 25 48,9 30 52,71 35 55,9 40 59,02 45 61,45 50 64 55 66,03 60 67,99 65 69,67 70 71,35 75 72,74 80 74,07 85 75,17 90 76,33 95 77,19 100 78,18 105 78,93 110 79,68 115 80,32 120 80,9 125 81,48 130 82 135 82,46 140 82,92 145 83,27 150 83,622 155 83,96 160 84,25 165 84,43 170 84,72 175 84,89 180 85,18 185 85,24 190 85,47 195 85,59 200 85,59 205 85,59 210 85,59 215 85,59 220 85,59 225 85,59 230 85,59 235 85,59 240 85,59 245 85,59 250 85,59 255 85,59 260 85,59
Gs1 = tf([1],[1 5 10 10 5 1],'InputDelay',3); [y,t] = step(Gs1); h = mean(diff(t)); dy = gradient(y, h); % Numerical Derivative [~,idx] = max(dy); % Index Of Maximum b = [t([idx-1,idx+1]) ones(2,1)] \ y([idx-1,idx+1]); % Regression Line Around Maximum Derivative tv = [-b(2)/b(1); (1-b(2))/b(1)]; % Independent Variable Range For Tangent Line Plot f = [tv ones(2,1)] * b; % Calculate Tangent Line figure plot(t, y) hold on plot(tv, f, '-r') % Tangent Line plot(t(idx), y(idx), '.r') % Maximum Vertical hold off grid
- Assistant
Ja, ich kann die Werte an den Code anpassen. Welche Werte möchtest du genau anpassen?
- User
alle werte bitte
- Assistant
Natürlich! Hier ist der angepasste Code mit den gegebenen Werten:
import numpy as np import matplotlib.pyplot as plt t = np.array([0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260]) y = np.array([23.78, 29.57, 35.41, 40.33, 44.96, 48.9, 52.71, 55.9, 59.02, 61.45, 64, 66.03, 67.99, 69.67, 71.35, 72.74, 74.07, 75.17, 76.33, 77.19, 78.18, 78.93, 79.68, 80.32, 80.9, 81.48, 82, 82.46, 82.92, 83.27, 83.622, 83.96, 84.25, 84.43, 84.72, 84.89, 85.18, 85.24, 85.47, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59, 85.59]) h = np.mean(np.diff(t)) dy = np.gradient(y, h) idx = np.argmax(dy) b = np.linalg.lstsq(np.vstack([t[idx-1:idx+1], np.ones(2)]).T, y[idx-1:idx+1], rcond=None)[0] tv = np.roots(b[::-1]) f = np.polyval(b, tv) plt.plot(t, y) plt.plot(tv, f, '-r') plt.scatter(t[idx], y[idx], c='r') plt.grid(True) plt.show()