# Generating two signals and concatenating them

2 Ansichten (letzte 30 Tage)
Peter Cristian am 4 Apr. 2022
Bearbeitet: Geoff Hayes am 4 Apr. 2022
I've got this code that is supposed to concatenate 2 singals, the problem is that i dont know what time i should put for the program to look how it is supposed to look.
ts=12000;
t=0:1/12000:159/12000;
A1=0.4;
A2=0.3;
f1=100;
f2=330;
x1=A1*sin(2*pi*f1*t);
x2=A2*sin(2*pi*f2*t);
s=[x1,x2,x1,x1,x2,x2,x1,x2];
plot(s);
It is supposed to look like this
But instead it looks like this, how should i swap the code.
The exercise sounds like: Generate a useful modulated signal corresponding to a bit string 01001101 in this way following: - for bit 0: a sinusoidal component of amplitude of 0.4V, frequency of 100Hz - for bit 1: a sinusoidal component of amplitude of 0.3V, frequency of 330Hz Each bit has a duration of 20ms without pause between bits (total signal duration is 160 ms). A sampling frequency of 12kHz is used.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Geoff Hayes am 4 Apr. 2022
@Peter Cristian - why are you using
159/12000
? Wouldn't that correspond to
159/12000 = 0.1325 seconds
when you should have 0.02 seconds instead which corresponds to the 20 ms duration for each bit. I think you might have been confusing the 160 ms duration for the total signal with the 20 ms required for each bit (though I think using 159 in this manner is still incorrect).
##### 7 Kommentare6 ältere Kommentare anzeigen6 ältere Kommentare ausblenden
Peter Cristian am 4 Apr. 2022
Ok, i got it now, thanks for your explanations, you have helped me a lot.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Pulsed Waveforms in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by