Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
gwnoise.m
Package: 现代通信系统matlab版源代码.zip [view]
Upload User: loeagle
Upload Date: 2013-03-02
Package Size: 1236k
Code Size: 2k
Category:
Communication Document
Development Platform:
Matlab
- function [m, d, s] = gwnoise(m, d, s)
- %GWNOISE generate valid mean value, standard deviation and seeds for GWNOISE block.
- % [M, D, S] = GWNOISE(M, D, S) checks input mean M, standard deviation D, and
- % seed S. When they are not valid, converts them to be valid for GWNOISE
- % block, or gives out an error message.
- %
- % Copyright 1996-2001 The MathWorks, Inc.
- % $Revision: 1.17 $
- if nargin ~= 3
- error('Input variable must be 3 for GWNOISE.');
- end;
- m = m(:)';
- s = s(:)';
- l_m = length(m);
- l_s = length(s);
- [n_d, m_d] = size(d);
- if n_d ~= m_d
- if min(n_d, m_d) == 1
- if any(d < 0)
- error('Standard deviation cannot be negative number.');
- end
- d = diag(d);
- else
- error('Standard deviation for Gaussian noise block is not valid.');
- end;
- else
- [n_d, m_d] = chol(d);
- if m_d ~= 0
- error('Standard deviation for Gaussian noise must be positive definite.');
- end;
- end;
- l_d = length(d);
- if ((l_m < l_d) & (l_m ~= 1)) | ((l_m > l_d) & (l_d ~= 1))
- error('The dimensions of the mean and standard deviation for Gaussian noise block are not compatible.');
- end;
- max_l = max(l_m, l_d);
- if l_s < max_l
- new_seed = 1;
- while l_s < max_l
- seed_pos = find(s == new_seed);
- if (length(seed_pos) == 0)
- s = [s, new_seed];
- l_s = length(s);
- end
- new_seed = new_seed + 1;
- end
- elseif l_s > max_l
- if max_l ~= 1
- s = s(1 : max_l);
- else
- d = eye(l_s) * d;
- end;
- end;
- [d, tmp] = chol(d);
- if tmp > 0
- error('Covariance matrix in AWGN noise generator is not a positively defined matrix.');
- end;
- % end of gwnoise