I am getting amplitude zero, But it is impossible
1 view (last 30 days)
Show older comments
Dipsikha Roy
on 3 Mar 2021
Commented: Dipsikha Roy
on 24 Apr 2021
I am getting a graph where amplitude is zero,How it possible?
I am attchimg here code which generate this graphs
clc;
M =8; %here we initialize the number of constellation point of qam
no_of_data_bits=1024;
Fm=10^6;%Max freq
block_size = 16; %Size of each OFDM block to add cyclic prefix
cp_len = floor(0.1 * block_size); %Length of the cyclic prefix
data_source= abs(round(randn(1,no_of_data_bits)));%here we take random normal function
figure(1);
x=1:no_of_data_bits;
stem (x*(1/Fm),data_source);
grid minor;
xlabel('time(Microsecond)','Fontsize',14);
ylabel('amplitude','Fontsize',14);
title('Transmitted Data','Fontsize',14);%here we plot that transmitted data
qam_modulated_data = qammod(data_source, M);%here we perform 8bit qam on the random normal function
nqdata = length(qam_modulated_data);
data = 0:M-1;
scatterplot(qam_modulated_data,1,0,'r*');
[udata, uidx] = unique(qam_modulated_data);
nudata = length(udata);
grid minor
for k=1:nudata
text(real(udata(k))-0.4,imag(udata(k))+0.4,num2str(data_source(uidx(k))));
end
axis([-4 4 -2 2])
qm = abs(qam_modulated_data);
figure(3);
stem(qm)
title('MODULATED TRANSMITTED DATA','Fontsize',14);%here we plot those constellation point
y=ifft(qam_modulated_data);
figure(4);
x=1:nqdata;
stem(x*Fm,abs(y));
grid minor;
xlabel('freq(Mhz)');
ylabel('amplitude of ifft');
title('without hermitian ifft','Fontsize',14);
I dont know why zero amplitude is coming,please help.
1 Comment
Cris LaPierre
on 3 Mar 2021
One observation - you take the ifft of a time-domain signal, and label the x axis as frequency. Did you mean to take the fft instead?
Accepted Answer
Walter Roberson
on 3 Mar 2021
Not 0. The value in the first location is enough larger than the rest of the data, that the rest of the data appears close to the axes in comparison. Below I skip plotting the first point.
Remember that fft() and ifft() are close to being the same operation, so when you ifft() your time domain signal, that is close to being the same as doing fft() of the time domain signal. And, just like if you had done fft(), the first output bin will be the sum of the time domain signal, so if your time domain signal has a non-zero mean then the first output bin can end up being much higher in magnitude than the other outputs.
M =8; %here we initialize the number of constellation point of qam
no_of_data_bits=1024;
Fm=10^6;%Max freq
block_size = 16; %Size of each OFDM block to add cyclic prefix
cp_len = floor(0.1 * block_size); %Length of the cyclic prefix
data_source= abs(round(randn(1,no_of_data_bits)));%here we take random normal function
figure(1);
x=1:no_of_data_bits;
stem (x*(1/Fm),data_source);
grid minor;
xlabel('time(Microsecond)','Fontsize',14);
ylabel('amplitude','Fontsize',14);
title('Transmitted Data','Fontsize',14);%here we plot that transmitted data
qam_modulated_data = qammod(data_source, M);%here we perform 8bit qam on the random normal function
nqdata = length(qam_modulated_data);
data = 0:M-1;
scatterplot(qam_modulated_data,1,0,'r*');
[udata, uidx] = unique(qam_modulated_data);
nudata = length(udata);
grid minor
for k=1:nudata
text(real(udata(k))-0.4,imag(udata(k))+0.4,num2str(data_source(uidx(k))));
end
axis([-4 4 -2 2])
qm = abs(qam_modulated_data);
figure(3);
stem(qm)
title('MODULATED TRANSMITTED DATA','Fontsize',14);%here we plot those constellation point
y=ifft(qam_modulated_data);
figure(4);
x=1:nqdata;
stem(x(2:end)*Fm,abs(y(2:end)));
grid minor;
xlabel('freq(Mhz)');
ylabel('amplitude of ifft');
title('without hermitian ifft','Fontsize',14);
2 Comments
More Answers (0)
See Also
Categories
Find more on OFDM in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!