CCS

Matlab Coding

 

 


 1 % MATLAB script for Illustrative Problem 10.2.
 2 echo on
 3 pn0_db=[-20:0.1:30];
 4 pn0=10.^(pn0_db./10);
 5 capacity=3000.*log2(1+pn0/3000);          # equation 10.2.5
 6 pause % Press a key to see a plot of channel capacity vs. P/N0.
 7 clf
 8 semilogx(pn0,capacity)
 9 title('Capacity vs. P/N0 in an AWGN channel')
10 xlabel('P/N0')
11 ylabel('Capacity (bits/second)')
12 clear
13 w=[1:10,12:2:100,105:5:500,510:10:5000,5025:25:20000,20050:50:100000];
14 pn0_db=25;
15 pn0=10^(pn0_db/10);
16 capacity=w.*log2(1+pn0./w);              # equation 10.2.5
17 pause % Press a key to see a plot of channel capacity vs. bandwidth.
18 clf
19 semilogx(w,capacity)
20 title('Capacity vs. bandwidth in an AWGN channel')
21 xlabel('Bandwidth (Hz)')
22 ylabel('Capacity (bits/second)')


Simulation Result
  a plot of channel capacity vs. P/N0
  
  
  a plot of channel capacity vs. bandwidth
  

Reference,

  1. <<Contemporary Communication System using MATLAB>> - John G. Proakis

原文地址:https://www.cnblogs.com/zzyzz/p/13747246.html