0
votes

We have a ASK modulated signal. We need the Fourier Transform, therefore I used FFT, but do I need to abs() for only one side? And is my code complete? I'm also not sure how to transfer from time domain (t) to frequency domain (f) in order to do the matlab.

clear all;
clc;
close all;

F1=input('Enter the frequency of carrier=');
F2=input('Enter the frequency of pulse=');
A=3;
t=0:0.001:1;
x=A.*sin(2*pi*F1*t);
u=A/2.*square(2*pi*F2*t)+(A/2);
v=x.*u;

figure
subplot(4,1,1);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Carrier');
grid on;
subplot(4,1,2);
plot(t,u);
xlabel('Time');
ylabel('Amplitude');
title('Square Pulses');
grid on;
subplot(4,1,3);
plot(t,v);
xlabel('Time');
ylabel('Amplitude');
title('ASK Signal');
grid on;
fs=100;
q=fft(v);
subplot(4,1,4);
plot(fs,q);
grid on;
2

2 Answers

0
votes

If you are not sure if you should use abs() or not, use it. For more info.

fs=100;
q=abs(fft(v));
subplot(4,1,4);
plot(q);
0
votes

Depends on how you want to look at the resulting FFT. The function fft(v) is usually complex. There are two ways to examine a FFT. One the most used, is phase/magnitude plot and the other is I and Q representation, which are the coefficients of the sine and cosine harmonics.

If you want to look at the magnitude and phase, then you ask this. abs(fft(v)) for magnitude, and angle(fft(v)) for phase

If you instead want to look at in form the I and Q channels, then ask this: real(fft(v)) and imag(fft(v))

Shift is a good idea to move the spectrum to zero center. It makes a spectrum more comprehensible.