Added done Work
This commit is contained in:
BIN
prak5/5.4.1_LED.npy
Executable file
BIN
prak5/5.4.1_LED.npy
Executable file
Binary file not shown.
BIN
prak5/5.4.1_Leuchtstoffroehre.npy
Executable file
BIN
prak5/5.4.1_Leuchtstoffroehre.npy
Executable file
Binary file not shown.
BIN
prak5/5.4.1_glueh.npy
Executable file
BIN
prak5/5.4.1_glueh.npy
Executable file
Binary file not shown.
24
prak5/Messung5.py
Executable file
24
prak5/Messung5.py
Executable file
@@ -0,0 +1,24 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import mdt
|
||||
|
||||
|
||||
data = mdt.dataRead(amplitude = 10, samplingRate = 24000, duration =2, channels = [0,1], resolution = 14, outType = 'Volt',
|
||||
continues = False)
|
||||
|
||||
plt.plot(data[0], label='Spannung')
|
||||
plt.plot(data[1], label='Strom')
|
||||
|
||||
print(data)
|
||||
|
||||
plt.legend()
|
||||
|
||||
|
||||
# 5.4.1
|
||||
# np.save('5.4.1_glueh.npy', data)
|
||||
# np.save('5.4.1_LED.npy', data)
|
||||
# np.save('5.4.1_Leuchtstoffroehre.npy', data)
|
||||
|
||||
|
||||
# 5.4.3
|
||||
# np.save('5.4.3_Leuchtstoffroehre.npy', data)
|
||||
BIN
prak5/aufgabe_5,4,3glüh.npy
Executable file
BIN
prak5/aufgabe_5,4,3glüh.npy
Executable file
Binary file not shown.
1809
prak5/dimmer.svg
Normal file
1809
prak5/dimmer.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 59 KiB |
1332
prak5/dimmer_mesung.svg
Normal file
1332
prak5/dimmer_mesung.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 40 KiB |
1450
prak5/dimmer_theorie.svg
Normal file
1450
prak5/dimmer_theorie.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 39 KiB |
1391
prak5/glühbirne_verlauf.svg
Normal file
1391
prak5/glühbirne_verlauf.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 36 KiB |
1491
prak5/leuchtröhre_verlauf.svg
Normal file
1491
prak5/leuchtröhre_verlauf.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 39 KiB |
67
prak5/test2.py
Normal file
67
prak5/test2.py
Normal file
@@ -0,0 +1,67 @@
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
def generate_sin_wave(frequency, amplitude, duration, phase_shift=0):
|
||||
"""
|
||||
Generate a sine wave with specified parameters.
|
||||
|
||||
Parameters:
|
||||
frequency (float): Frequency of the sine wave in Hz
|
||||
amplitude (float): Amplitude of the sine wave
|
||||
duration (float): Duration of the sine wave in seconds (can be fractional)
|
||||
phase_shift (float): Phase shift in radians (default: 0)
|
||||
|
||||
Returns:
|
||||
tuple: (time_array, sine_wave_array)
|
||||
"""
|
||||
# Generate time array with fractional seconds support
|
||||
sample_rate = 44100 # Standard audio sample rate
|
||||
num_samples = int(duration * sample_rate)
|
||||
t = np.linspace(0, duration, num_samples)
|
||||
|
||||
# Generate sine wave with phase shift
|
||||
y = amplitude * np.sin(2 * np.pi * frequency * t + phase_shift)
|
||||
|
||||
return t, y
|
||||
|
||||
|
||||
t, v = generate_sin_wave(60, 325, 0.045, 0)
|
||||
t2, i = generate_sin_wave(60, 0.125, 0.045, 45)
|
||||
|
||||
w = np.multiply(v,i)
|
||||
V = np.divide(230, np.sqrt(2))
|
||||
I = np.divide(0.125, np.sqrt(2))
|
||||
P = np.multiply(np.multiply(V,I), np.cos(np.deg2rad(45)))
|
||||
q = np.multiply(np.multiply(V,I), np.sin(np.deg2rad(45)))
|
||||
s = np.sqrt(np.square(P) + np.square(q))
|
||||
|
||||
S = []
|
||||
for _ in range(len(t)):
|
||||
S.append(s)
|
||||
Q = []
|
||||
for _ in range(len(t)):
|
||||
Q.append(q)
|
||||
|
||||
|
||||
|
||||
# plot a graph with i, v and w over t
|
||||
plt.plot(np.multiply(t, 1000), v, label='voltage in V')
|
||||
plt.plot(np.multiply(t2, 1000), np.multiply(i, 1000), label='current in mA')
|
||||
plt.plot(np.multiply(t, 1000), w, label='Leistung in W')
|
||||
# plt.plot(np.multiply(t, 1000), P, label='Wirkleistung in W')
|
||||
plt.plot(np.multiply(t, 1000), Q, label='Blindleistung in W')
|
||||
# plt.plot(np.multiply(t, 1000), S, label='Scheinleistung in W')
|
||||
plt.legend()
|
||||
plt.grid()
|
||||
plt.xlabel('time in ms')
|
||||
plt.ylabel('value')
|
||||
|
||||
#save plot as svg
|
||||
# plt.savefig('prak5/glühbirne_verlauf.svg', format='svg')
|
||||
plt.savefig('prak5/leuchtröhre_verlauf.svg', format='svg')
|
||||
|
||||
plt.show()
|
||||
|
||||
0x7ffbfe8
|
||||
|
||||
0x7ffbff4
|
||||
Reference in New Issue
Block a user