Square Wave from a sequence of bits
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everyone,
I want to generate a square wave with Amplitude 0 and 1, starting from an Array made by 0,1 sequence
if A(i)=0 the amplitude of my wave is set to 0
else A(i)=1 the amplitude is set to 1
with a frequency of 10^10 Hz
and a Total period T= A[] number of elements * frequency
thanks
0 Commenti
Risposte (1)
Kiran Felix Robert
il 18 Dic 2020
Hi Nicolo,
Setting the time vector accordingly directly gives you a square wave, if you want to visualize it you can use the stairs function
The following is an example,
A = [0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1];
ts = 10e-10; % Sampling Time based on your frequency
t = 0:ts:((length(A)-1)*ts); % Time Vector
s = stairs(t,A); % Plotting
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!