how to plot sine wave signal with synchronous and non synchronous sampling?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
TUAN SHARIFAH NUR FATIEHA
el 2 de Oct. de 2023
Comentada: Walter Roberson
el 29 de Oct. de 2023
how to plot sine wave signal with synchronous and non synchronous sampling in time domain with formula
s(t) = A*sin(2*pi*f*t + phi )
the graph must s(t) versus number of cycle?
where should i coded the number of cycles?
0 comentarios
Respuestas (1)
recent works
el 2 de Oct. de 2023
Please check the python code:
Import the necessary libraries:
import numpy as np
import matplotlib.pyplot as plt
Define the parameters of your sine wave signal, including amplitude (A), frequency (f), phase (phi), and the sampling rate (Fs).
A = 1.0 # Amplitude of the sine wave
f = 5.0 # Frequency of the sine wave (in Hz)
phi = 0.0 # Phase of the sine wave (in radians)
Fs_sync = 50.0 # Synchronous sampling rate (samples per second)
Fs_non_sync = 10.0 # Non-synchronous sampling rate (samples per second)
Define the time vector for both synchronous and non-synchronous sampling. The number of cycles should be specified here.
# Number of cycles for the signal
num_cycles = 5
# Time vector for synchronous sampling
t_sync = np.arange(0, num_cycles * 1 / f, 1 / Fs_sync)
# Time vector for non-synchronous sampling
t_non_sync = np.arange(0, num_cycles * 1 / f, 1 / Fs_non_sync)
Calculate the sine wave signal for both sampling rates:
# Calculate the synchronous sine wave
s_sync = A * np.sin(2 * np.pi * f * t_sync + phi)
# Calculate the non-synchronous sine wave
s_non_sync = A * np.sin(2 * np.pi * f * t_non_sync + phi)
Plot the results using Matplotlib:
# Plot the synchronous sampled signal
plt.figure(figsize=(12, 6))
plt.subplot(2, 1, 1)
plt.plot(t_sync, s_sync)
plt.title('Synchronous Sampling')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.grid()
# Plot the non-synchronous sampled signal
plt.subplot(2, 1, 2)
plt.plot(t_non_sync, s_non_sync)
plt.title('Non-Synchronous Sampling')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.grid()
plt.tight_layout()
plt.show()
---------------------------------------------------------------------------------
1 comentario
Walter Roberson
el 29 de Oct. de 2023
Using a lower sampling frequency is not non-synchronous sampling !
In fully digital receivers, carrier and timing information is derived from samples of the (anti-aliasing-filtered) received continuous-time signal. In case of synchronized sampling, this information is used to align the sampling clock of the receiver with the remote transmit clock. In nonsynchronized sampling systems, the sampling at the receiver is performed by means of a fixed free-running clock, and additional post-processing is necessary to perform timing correction in the digital domain.
In other words, for non-synchronous sampling, you need to do clock recovery from the waveform, somehow .
Imagine for example that you are generating a sine wave on the International Space Station and sending it to a ground station on Earth. For simplification, suppose we have a pretty decent Phased Locked Loop (PLL) clock on the ISS, that is accurate to (say) 1 part in 1 billion -- that is, for the purpose of this particular example, assume that the source timer is very reqular. So this accurate sine signal is generated and beamed to Earth, and the ground station samples it with a high accuracy receiver... and as far as the ground receiver can tell, the signal generator on the ISS must be malfunctioning.
Why? Because the ISS is moving faster than the ground station, and so is subject to relativistic time dilation. "One second" as experienced in the ISS is a different duration than "one second" as experienced by the ground station.
Therefore if you were sending a communications signal from ISS to a ground station, then even if you have excellent clock sources on both sites, you need to do "clock recovery" on the received signal: the received signal is non-synchronous.
This is, by the way, a real issue. GPS satellites are traveling faster than people on the ground, so they had to include time dilation correction into the design of GPS systems.
But more generally, you might be running a source system that does not have the most accurate of clocks. Two CPUs the same computer will run at slightly different rates. Clock cycles can be lost if a host is servicing interrupts. "Clock drift" happens all of the time . Synchronizing the time between different systems is hard (you can sort of do it for adjacent systems, but as soon as you move one of them you lose synchronization due to time dilation effects.)
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!