FFT of an ASK signal
조회 수: 8 (최근 30일)
이전 댓글 표시
I'm trying to graph the ASK modulation signal in the frequency domain, but the output figure I get is this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1020310/image.jpeg)
This is my code, basically I just apply an fft() to de ASK signal, that is s_t. I don't know what i'm doing wrong, theorically this should work well.
clc
close all
clear
fb=1000; %frecuency of the square signal
Tb=1/fb;
t=0:Tb/999:7*Tb; %time vector
fc=100; %frecuency of the carrier
A=1; %amplitude of the signal
cosine = A.*cos(2*pi*fc*t); %carrier
subplot(4,1,1)
plot(t,cosine)
xlabel('Time')
ylabel('Amplitude')
title('Carrier')
m_t = A/2.*square(2*pi*fb*t)+(A/2);%Binary signal
subplot(4,1,2)
plot(t,m_t)
xlabel('Time')
ylabel('Amplitude')
title('Pulsos binarios')
s_t = cosine.*m_t; % ASK signal
subplot(4,1,3)
plot(t,s_t)
xlabel('Time')
ylabel('Amplitude')
title('ASK')
N=length(m_t);
f =(0:N-1)*(fb/N);
fftASK=fft(s_t);%Fourier ASK signal
subplot(4,1,4)
plot(f,abs(fftASK))
xlabel('frequency')
ylabel('ASK amplitude')
title('fft ASK')
figure(2)
plot(fftASK)
댓글 수: 0
채택된 답변
Chunru
2022년 6월 3일
plot the abs of fft.
fb=1000; %frecuency of the square signal
Tb=1/fb;
fs = 999/Tb;
%t=0:Tb/999:7*Tb; %time vector
t=0:1/fs:7*Tb; %time vector
fc=100; %frecuency of the carrier
A=1; %amplitude of the signal
cosine = A.*cos(2*pi*fc*t); %carrier
subplot(4,1,1)
plot(t,cosine)
xlabel('Time')
ylabel('Amplitude')
title('Carrier')
m_t = A/2.*square(2*pi*fb*t)+(A/2);%Binary signal
subplot(4,1,2)
plot(t,m_t)
xlabel('Time')
ylabel('Amplitude')
title('Pulsos binarios')
s_t = cosine.*m_t; % ASK signal
subplot(4,1,3)
plot(t,s_t)
xlabel('Time')
ylabel('Amplitude')
title('ASK')
N=length(m_t);
f =(0:N-1)*(fb/N);
fftASK=fft(s_t);%Fourier ASK signal
subplot(4,1,4)
plot(f,abs(fftASK))
xlabel('frequency')
ylabel('ASK amplitude')
title('fft ASK')
figure(2)
n = length(fftASK);
plot((0:n-1)/n*fs, abs(fftASK));
xlabel('f (Hz)');
ylabel('Amp')
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!