Could anybody please help me to execute the code

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

Please read this link and fix your formatting.
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???

Sign in to comment.

Categories

Tags

Asked:

on 21 Nov 2017

Answered:

on 21 Nov 2017

Community Treasure Hunt

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

Start Hunting!