# Continuous to Discrete time signal

조회 수: 1(최근 30일)
답변: Jon 2020년 11월 10일
Hello,
I have 2 frequencies combined together to one graph to form continuous time signal. How can I turn it to discrete time signal? I am struggling with combining 2 frequencies to discrete time.
I have written data for discrete time, but is there a way to turn it into one?
t = 0:0.001:1.8
Fq1 = 1
Fq2 = 6
x_t = sin(2*pi*Fq1*t) + sin(2*pi*Fq2*t)
plot (t, x_t, 'LineWidth', 2)
hold on
Fs1 = 10 % 2hz * 5
Fs2 = 60 % 12hz * 5
Ts1 = 1/Fs1 % Sampling period Ts1 = 1/10hz
Ts2 = 1/Fs2 % Sampling period Ts = 1/60hz
T2 = 1/Fq2 % The period 2
T1 = 1/Fq1 % The period 1
N1 = T1/Ts1 % Number of samples per period
N2 = T2/Ts2
n2 = 0:1:2*N2 - 1
n1 = 0:1:2*N1 - 1 % 20 samples range
nTs1 = n1 * Ts1 % Sampling interval (samples range multiplied by sampling period to have a range of data for graph)
nTs2 = n2 * Ts2
x_n1 = sin(2*pi*3*nTs1) + sin(2*pi*3*nTs2)% Discrete signal formula and calculation
stem(nTs1, x_n1) % doesn't work
hold on

댓글을 달려면 로그인하십시오.

### 답변(1개)

Jon 2020년 11월 10일
You should just evaluate and save your values x_t once
Then to get your discrete samples (assuming the discrete sample interval is a multiple, m, of your original sampling interval ) you can use something like
k = 1:n:length(x_t)
stem(t(k),x_t(k))

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!

Translated by