Can you help me out on making the BER vs SNR plot ?

51 ビュー (過去 30 日間)
Altin Guberi
Altin Guberi 2016 年 12 月 3 日
コメント済み: Altin Guberi 2016 年 12 月 3 日
I am trying to make the plot BER (Bit Error Correction ) versus SNR (Signal To Noise Ratio) via the following code:
clc;clear;close all
% Number of Bytes
% Noise Generation
% Calculation Of Signal
% Calculation Of Noise
% Calculation of SNR
for ii=1:length(SNR)
% noise addition
y = x + 10^(SNR(ii)/20)*n; % additive white gaussian noise
ipHat = real(y)>0;
nErr(ii) = size(find([n- ipHat]),2);
figure (1)
mypower function is: function P=mypower(x)
Okay , so If I will execute the code I will get only one star at the graph . Can you please tell me if there is anything anything I can change in order to get the graph with all the possible points/stars ?
Thank you .
  1 件のコメント
Tamir Suliman
Tamir Suliman 2016 年 12 月 3 日
what is the function mypower(x) is not defined correctly ?


回答 (1 件)

Daniel kiracofe
Daniel kiracofe 2016 年 12 月 3 日
Not 100% sure of the final answer here, but based on your statement that you are only getting 1 star on the graph, I assume that you are expecting SNR and BER to be arrays. Right now they are just scalars, so that is why you are only getting 1 star. The way you have written it, SNR will have the same size as Px. And px has the size of whatever is returned from mypower(). And mypower returns a scalar, because of the sum() function in there. So if you want SNR to be an array, you have two options, depending on what you are trying to do: 1) modify mypower to return an array instead of a scalar 2) add another loop around the entire code (e.g. for j=1:something), vary some parameter of interest with every iteration of j, and then compute SNR(j) = 10*log10(Px./Pn) on each iteration (hope that makes sense).
  1 件のコメント
Altin Guberi
Altin Guberi 2016 年 12 月 3 日
How to make arrays function ?


Community Treasure Hunt

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

Start Hunting!

Translated by