Effacer les filtres
Effacer les filtres

FFT of an ASK signal

8 vues (au cours des 30 derniers jours)
franco hauva
franco hauva le 3 Juin 2022
Réponse apportée : Chunru le 3 Juin 2022
I'm trying to graph the ASK modulation signal in the frequency domain, but the output figure I get is this:
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)

Réponse acceptée

Chunru
Chunru le 3 Juin 2022
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')

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by