Could anybody please help me to execute the code
Show older comments
clear all
close all
clc
nt_v = [1 2 3 2 4];
nr_v = [1 2 2 3 4];
N0 = 1e-4;
B = 1;
Iteration = 1e4;
SNR_V_db = [-10:3:20];
SNR_V = 10.^(SNR_V_db/10);
color = ['b';'r';'g';'k';'c'];
notation = ['-o';'->';'<-';'-^';'-s'];
for(k = 1 : 5)
nt = nt_v(k);
nr = nr_v(k);
for(i = 1 : length(SNR_V))
pt = N0 * SNR_V(i);
for(j = 1 : Iteration)
H = random('rayleigh',1,nr,nt);
[S V D] = svd(H);
landas(:,j) = diag(V);
[capacity(i,j) powerallo] = waterfilling_alg (pt,landas(:,j),B,N0)
end
end
f1 = figure(1);
hold on
plot(SNR_V_db,mean(capacity'),notation(k,:),'color',color(k,:))
f2 = figure(2);
hold on
[y,x] = hist(reshape(landas,[1,min(nt,nr)*iteration]),100);
plot(x,y/iteration,'color',color(k,:));
clear landas
end
2 Comments
Image Analyst
on 21 Nov 2017
Image Analyst
on 21 Nov 2017
No, we can't run it either because we do not have the variable or function called "waterfilling_alg". What is the reason why YOU can't run it? Same reason???
Answers (1)
Walter Roberson
on 21 Nov 2017
0 votes
Perhaps your waterfilling_alg should instead be WaterFilling_alg from https://www.mathworks.com/matlabcentral/fileexchange/12491-mimo-rayleigh-fading-channel-capacity
Categories
Find more on Startup and Shutdown 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!