Generalized-K in BPSK
4 views (last 30 days)
Show older comments
Hi, I am working on the Generalized-K equation in MATLAN and I keep getting errors on matrix dimensions must agree. I am clueless which part I should change or include to slove this problem.
clc; clear all; close all;
colors=['r','g','b'] ;
N0= 1;
M =4;
m = 1;
T1 = gamma(M);
T2 = gamma(m);
t1 = gamma(M+1);
t2 = gamma(m+1);
%Value of b
w = 4*(t1*t2)/(T1*T2);
b = sqrt(w);
z = 0:20;
%Bessel function
Besselfunc = besselk(M-m,z);
%SNR
SNRindB=0:20;
SNR=10.^(SNRindB/10);
%Prob of error
x = [0:0.5:10]
for w = 1:3 % w is the average power
for ii = 1:length(x)
y(ii)=((2*m^m)/(gamma(m)*w^m))*x(ii)^(2*m-1)*exp(-((m/w)*x(ii)^2)); % Nakagami pdf
end
end
error = (1/2)*erfc(sqrt(x.^2.*SNR));
%PDF of generalized-k
f =@(x) (2*b)/(T1*T2)*((b.*x)/2).^(M+m-1).*(Besselfunc.*(b.*x)).*error;
func = integral(f,0,1)+ integral(f,1,25);
semilogy(SNRindB,func,'-');
xlabel('Average SNR(dB)');
ylabel('Average Probability of Error');
grid on;
hold on;
I hope I can solve this error soon.
Thank you for your time
0 Comments
Answers (0)
See Also
Categories
Find more on Language Fundamentals 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!