How to plot an array as a binary Wave

Suppose I have an array that stores binary values, eg A=[1 0 1 0 1 1 0 1 0 1 0...]
I want to send the array as a binary pulse, also for a specific amount of time, eg t=3 seconds. How would I make that binary wave?

5 Comments

For your purposes, what does it mean to "send" the array? Is there a signal generator involved? Is it a BIsync line with a bit interface?
I have an array stored with binary values that I would modulate with a sin wave via FSK. The plan is to have 3 seconds for bit the binary stream and the sin wave so that I have a modulated wave of exactly 3 seconds. The PCM waveform would only be used as a reference, as I plan to use the FSK wave to be sent acoustically.
Is the next step to repeat the binary for an appropriate time and then FSK encode it? https://www.mathworks.com/help/comm/ref/fskmod.html
I'm not going to be repeating the binary, I only want to plot it for that specific total time, but the next step is going to be modulating it and then sending it out through a speaker. I won't be using fskmod because it doesn't involve a sinosiodal wave, the method I would use to modulate the wave would be something like this:
t=0:0.001:3; %The time I need to make an fsk wave
f=1000; %The message signal's frequency
x=2*square(2*3.14*f.*t)+2; %In this case, the message is a square wave, which I will be replacing with said pcm waveform
subplot(8,1,1);
plot(t,x, 'r');
title('Message');
CL=4*sin(2*3.14*10000.*t); %Low frequency carrier
subplot(8,1,2);
plot(t,CL, 'r');
title('Low Carrier');
CH=4*sin(2*3.14*30000.*t); %hi frequency carrier
subplot(8,1,3);
plot(t,CH, 'r');
title('High Carrier');
x2=4+gnegate(x); %inverted message
subplot(8,1,4);
plot(t,x2, 'r');
title('Inverted message');
M1=x2.*CL;
M2=x.*CH;
R=M1+M2;
subplot(8,1,5);
plot(t,R, 'r');
title('Modulation done');
What does it mean to you to send a wave for a specific period of time, without repeating it? If you had talked instead about having a bit stream and a sampling interval (or sampling frequency), and the time occupied was to be whatever was implied by the length and the sampling rate, then that would have made sense.

Sign in to comment.

Answers (0)

Asked:

on 3 Dec 2019

Commented:

on 3 Dec 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!