フィルターのクリア

FFT of an ASK signal

8 ビュー (過去 30 日間)
franco hauva
franco hauva 2022 年 6 月 3 日
回答済み: Chunru 2022 年 6 月 3 日
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)

採用された回答

Chunru
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 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by