دریافت فایل مقاله

Download Report

Transcript دریافت فایل مقاله

What is Matlab?
 Matrix Libratory
 Matlab is a matrix-based programming tool.
 High-performance language
 User-friendly environment
 The standard matrix exhibits two dimensions n×m
 Column vectors and row vectors are represented
consistently by n × 1 and 1 × n matrices,
MATLAB Working Environment
The Command Window
The Figure Window
Help and Online Documentation
Disk File Manipulation and Shell
Data Import/Export
Memory Utilization
Microsoft Windows Handbook
UNIX Handbook
The Command Window
The Command Window is the main window in
which you communicate with MATLAB.
The MATLAB interpreter displays a prompt (>>)
indicating that it is ready to accept commands from
you. For example, to enter a 3-by-3 matrix, you can
type
A = [1 2 3; 4 5 6; 7 8 10]
When you press the Enter or Return key, MATLAB
responds with
A=
1
2
3
4
5
6
7
8
10
Command Line Editing
Arrow and control keys on your keyboard allow you to recall,
edit, and reuse commands you have typed earlier. For
example, suppose you mistakenly enter
rho = (1+ sqt(5))/2
You have misspelled sqrt. MATLAB responds with undefined
function or variable ’sqt’. Instead of retyping the entire line,
simply press the key. The misspelled command is redisplayed.
Use the key to move the cursor over and insert the missing r.
Repeated use of the key recalls earlier lines.
Clearing the Command Window
Use clc to clear the Command Window. This does not
clear the workspace, but only clears the view. After
using clc, you still can use the up arrow key to see
the history of the commands, one at a time.
The format Command
The ‘format’ command controls the numeric format of the
values displayed on the screen. The command affects
only how numbers are displayed, not how MATLAB
computes or saves them.
On Windows platforms, you can change the default
format by selecting Preferences from the File menu, and
selecting the desired format from the General tab.
‫‪Isinf,isnan,isfinit‬‬
‫این توابع روی یک ماتریس عمل نموده و مشخص می کند کدام‬
‫عنصر یک آرایه دارای مقدار ‪ inf‬یا ‪ nan‬و یا ‪ -inf‬هستند‪.‬‬
‫)‪C=Max(A,B‬‬
‫در دو ماتریس یا ابعاد یکسان نظیر به نظیر مقایسه را انجام می‬
‫دهد‪.‬‬
‫)‪C=max(A,[]-j‬‬
various formats and the output
produced
x = [4/3
1.2345e–6]
format short
1.3333
0.0000
format short e
1.3333e+000
1.2345e–006
format short g
1.3333
1.2345e–006
format long
1.33333333333333
0.00000123450000
format long e
1.333333333333333e+000
1.234500000000000e–006
format long g
1.33333333333333
1.2345e–006
format bank
1.33
0.00
format rat
4/3
1/810045
format hex
3ff5555555555555
3eb4b6231abfd271
Suppressing Output
If you simply type a statement and press Return or
Enter, MATLAB automatically displays the results
on screen. However, if you end the line with a
semicolon, MATLAB performs the computation but
does not display any output. This is particularly useful
when you generate large matrices. For example,
A = magic(100);
Matlab Operations
 Arithmetic and logical operations
 Mathematical functions,
 Graphical functions
 Input/output operations
The building blocks of expressions
 Variables
 Numbers
 Operators
 Functions
Variables
When a new variable name is introduced, it
automatically creates the variable and allocates
the appropriate amount of memory.
Example:
>> books = 10
creates a 1-by-1 matrix named books and stores
the value 10 in its single element
Variable names
 Variable names consist of a string

Start with a letter
 Followed by any number of letters, digits, or
underscores

Matlab is case sensitive
Numbers
Matlab uses the conventional decimal
Scientific notation uses the letter e to specify a
power-of-ten scale
Imaginary numbers use either i or j as a suffix
Example:
7 -55 0.0041 9.657838
7.03352e21 2i
-2.71828j 2e3i
6.10220e-10
2.5+1.7j
pi
Operators
Example:
+ Addition
- Subtraction
* Multiplication
/ Division
’ Complex conjugate transpose
( ) Brackets to specify the evaluation order.
Functions
Matlab provides a large number of standard elementary
mathematical functions- Subtraction
Example:
What is the result of square root or logarithm of a
negative?
See some more function with this command
>> help elfun
Functions
Matlab provides a large number of standard
elementary mathematical functions- Subtraction
Example:
What is the result of square root or logarithm of a
negative?
Functions
Some of the functions, like sqrt and sin are built-in.
They are a fixed part of the Matlab core so they are
very efficient. The drawback is that the
computational details are not readily accessible.
Other functions, like gamma and sinh, are
implemented in so called M-files.You can see the
code and even modify it if you want
‫‪ -1‬برنامه ای بنویسید که خروجی آن ماتریس ی به شکل زیر باشد‪:‬‬
‫‪1‬‬
‫‪5‬‬
‫‪2‬‬
‫‪1‬‬
‫‪3‬‬
‫‪7‬‬
‫‪6‬‬
‫‪4‬‬
‫‪2‬‬
‫‪6‬‬
‫‪5‬‬
‫‪7‬‬
‫‪6‬‬
‫‪1‬‬
‫‪1‬‬
‫‪ -2‬درایه سطر اول و ستون سوم این ماتریس را نشان دهید‪.‬‬
‫‪ -3‬تمام درایه های واقع در ستون دوم را نشان دهید‪.‬‬
‫‪ -4‬تمام درایه های واقع در سطر اول را نمایش دهید‪.‬‬
‫‪ -5‬از سطر اول درایه ستون اول و سوم را نمایش دهد‪.‬‬
‫‪ -6‬از سطر سوم درایه های ستون اول تا سوم را نمایش‬
‫دهد‪.‬‬
‫‪ -7‬ابعاد ماتریس فوق را تعیین کنید‪.‬‬
‫‪ -8‬تعداد سطرها و ستونها را جداگانه مشاهده کنید‪.‬‬
‫‪ -9‬بزرگترین مود سطر یا ستون را در ماتریس نمایش دهید‪.‬‬
‫توضیح‪ :‬دستور )‪ length (A‬بین سطر یا ستون هر کد‬
‫ام بزرگتر است را نمایش میدهد‬
‫‪-11‬بزرگترین و کوچکترین عدد هر ستون را نشان دهید‬
‫‪-12‬بزرگترین و کوچکترین عدد از هر سطر را نشان دهید‬
‫‪-13‬حاصل جمع تمام ستون ها را در یک بردار نشان دهید‪.‬‬
‫‪-14‬حاصلضرب تمام اعضای ستون ها را در یک بردار نشان‬
‫دهید‪.‬‬
‫‪ -15‬اعضای هر ستون را به ترتیب صعودی لیست کند‪.‬‬
‫‪ -16‬اعضای هر ستون را به ترتیب نزو لی لیست کند‪.‬‬
‫‪ -7‬میانگین هر ستون را بدست آورد‪.‬‬
‫‪-18‬دستورهای ‪ 13‬تا ‪ 17‬را برای سطرها اجرا کنید‬
‫راهنمایی‪:‬‬
‫)‪Mean(A,2‬‬
‫‪ -19‬دترمینان ماتریس )‪(B‬را حساب کنید‪.‬‬
‫‪2‬‬
‫‪3‬‬
‫‪1‬‬
‫‪13‬‬
‫‪12‬‬
‫‪11‬‬
‫‪16‬‬
‫‪15‬‬
‫‪14‬‬
‫‪-20‬معکوس ماتریس ‪B‬را نمایش دهید‬
‫‪ –21‬حاصلضرب ماتریس ‪ A*B‬را محاسبه کنید‬
‫‪-22‬سطر سوم و اول ماتریس ‪ A‬را حزف و نتیجه را در‬
‫ماتریس ‪ C2‬قرار دهید‬
‫‪ -23‬سطر چهارم تا پنجم ماتریس ‪ A‬را حذف و نتیجه را‬
‫در ماتریس ‪ C3‬قرار دهید‪.‬‬
‫‪ -24‬ستون دوم و سوم ماتریس‪ A‬حذف شود‬
‫‪-24‬ماتریس ‪ C3‬را عضو به عضو در ماتریس ‪ B‬ضرب‬
‫کنید‬
‫با استفاده از توابع موجود در متلب‪:‬‬
‫‪ -1‬یک ماتریس تمام یک ‪ 5*3‬تولید کنید‬
‫‪ -2‬یک ماتریس تمام صفر ‪ 4*4‬تولید کنید‬
‫‪ -3‬یک ماتریس ‪ 3*3‬که قطر اصلی آن یک و سایر درایه های آن‬
‫صفر است را تولید کنید(به دو روش)‬
‫‪-4‬نتیجه این دستور را مشاهده کنید )‪eye(3,2‬‬
‫‪-5‬استفاده از روش حلقه یک ماتریس با ابعاد ‪ 5*3‬تمام یک‬
‫درست کنید‪.‬‬
‫‪-6‬این دو دستور را با هم مقایسه و نتایج آن را ببینید‪.‬‬
‫‪m1=1:10:100‬‬
‫)‪m2=linspace (1,100,10‬‬
‫‪-7‬سه عدد با فاصله مساوی بین ‪ 1‬و ‪ 4‬ایجاد کنید و آن را در‬
‫بردار ‪ d‬قرار دهید(کوچکترین عدد یک و بزرگترین آن ‪ 4‬است)‪.‬‬
‫‪-8‬حاصل ضرب ماتریس ‪ A‬را در معکوس ‪ d‬بدست آوریر‪.‬‬
‫‪-9‬لگاریتم در مبنای ‪ 2‬عدد ‪ ، 2‬لگاریتم در مبنای ‪ 10‬عدد ‪ 10‬و‬
‫لگاریتم طبیعی عدد ‪ 4‬را حساب کنید‬
‫‪ 5-10‬عدد تصادفی با توزیع یکنواخت تولید کنید‬
‫‪-11‬یک ماتریس تصادفی با توزیع ندمال‪ 3*3‬تولید کنید‬
‫‪ -12‬یک عد تصادفی با توزیع نرمال با میانگین ‪ 2‬و واریانس ‪3‬‬
‫تولید کنید‪.‬‬
‫توان و انرژی‬
‫‪ P‬محدود‬
‫توان (قدرت)‬
‫نتیجه کلی‪:‬‬
‫سیگنالها‬
‫انرژی‬
‫سیگنال‌های پریودیک‬
‫‪ E‬نامحدود‬
‫‪ E‬محدود‬
‫‪P‬صفر‬
‫سیگنال‌ها با دوره زمانی محدود‬
‫)‪(Time Limited signals‬‬
‫انرژي كل(انرژي بي نهايت و انرژي) سيگنال‬
‫پيوسته زمان‬
‫سیگنال های انرژی (مانند سیگنال محدود در حوزه زمان)‬
‫‪2‬‬
‫‪‬‬
‫‪E    g t  dt  ‬‬
‫سیگنال های توان (قدرت مانند سیگنال کسینوس ی)‬
‫‪g t  dt  ‬‬
‫‪2‬‬
‫‪T‬‬
‫‪1‬‬
‫‪T‬‬
‫‪T ‬‬
‫‪p  lim‬‬
‫‪ -16‬توان و انرژی سیگنال های زیر را حساب کنید‬
‫‪Y=t‬‬
‫)‪Y=cos(2100t‬‬
‫‪ -17‬مقدار تابع گاما به شکل زیر را حساب کنید‪:‬‬
‫‪‬‬
‫‪t‬‬
‫‪e dt‬‬
‫‪m 1‬‬
‫‪t‬‬
‫‪‬‬
‫‪x‬‬
‫‪ (m , x) ‬‬
‫‪ x=a*exp(-a*t)-13‬را تشکیل و مقدار آن را به ازای‬
‫‪ a=8, t=1‬بدست آورید‬
‫‪-14‬حد مقدار فوق را وقتی ‪ t‬به سمت ‪ 2‬میل می کند بدست‬
‫آورید‪.‬‬
‫‪ -15‬انرژی و توان سیگنال )‪exp(-t‬را تعیین و مشخص کنید‬
‫تجزیه یک عبارت به کسرهای جزئی‬
‫با استفاده از دستور ‪ residue‬در نرم افزار ‪ MATLAB‬ميتوان‬
‫يك عبارت را به كسرهاي جزئي تجزيه نمود ‪.‬‬
‫مثال‪:‬‬
‫‪2‬‬
‫‪ j  3  12  j  2  36  j  ‬‬
num = [2]; % numerator coefficients
den = [1 12 36 0]; % denominator coefficients
[r,p,k] = residue(num,den),
:‫ نتایج زیر به نمایش در مي آید‬،‫با اجراي این دستورات‬
r=
-0.0556
-0.3333
0.0556
p=
-6
-6
0
k=
[]
‫تبدیل فوریه‬
‫با استفاده از دستور ‪ fourier‬در نرم افزار ‪ MATLAB‬مي توان‬
‫تبديل فوريهي يك تابع نمادين را به دست آورد‪.‬‬
‫مثال‪:‬‬
‫تبدیل فوریه‬
‫‪t‬‬
‫‪x (t )  e‬‬
‫توجه‪ :‬توابع پله واحد و ضربه واحد در ‪MATLAB‬به ترتيب با توابع‬
‫‪ dirac‬و ‪ heaviside‬مشخص ميشوند‪.‬‬
FFT, IFFT
Discrete Fourier transform
Syntax
Y = fft(X)
Y = fft(X,n)
Y = fft(X,[],dim)
Y = fft(X,n,dim)
Definition
Y = fft(X) returns the discrete Fourier transform (DFT) of vector
X, computed with a fast Fourier transform (FFT) algorithm.
If X is a matrix, fft returns the Fourier transform of each column of
the matrix.
Y = fft(X,n) returns the n-point DFT. If the length of X is less than
n, X is padded with trailing zeros to length n. If the length of X is
greater than n, the sequence X is truncated. When X is a matrix, the
length of the columns are adjusted in the same manner.
Y = fft(X,[],dim) and Y = fft(X,n,dim) applies the FFT operation
across the dimension dim.
‫بررسی ماتریسی ‪FFT‬‬
DFT_Matrix
The last one which is called Discrete Fourier Transform
(DFT), can be represented in matrix form. Since a digital
computer works only with discrete data,numerical
computation of the Fourier transform of x(t) requires
discrete sample values of x(t), which we will call it x(nT
). In addition, a computer can compute X(f) only at
discrete values of f, that is, it can provide discrete
samples of the transform, X(mf0)
‫رسم نمودارها‬
plot(x,y) produces a graph of y versus x
xlabel(’time’);
ylabel(‘signal’);
title(’Fig-1 signal versus time’)
It is possible to specify the color, the line style and the
markers, such as plus signs or circles, with:plot(x , y ,
’color style marker’)
LineSpec (Line Specification)
Line style
Line width
Color
Marker type
Marker size
Marker face and edge coloring (for filled markers)
Marker Specifiers
‫تمرین‬
‫‪ -1‬تابع سینوس ‪ x‬را در فاصله ‪ 0‬تا ‪ 2‬رسم گنید‬
‫‪ -2‬محورهای ‪ x , y‬را نام گذاری کنید ‪.‬‬
‫‪-3‬نمودارهای )‪ sin(x) , sin(x-a),sin(x-b‬را روی یک‬
‫دستگاه مختصات با رنگ های مختلف و عالئم مختلف و‬
‫خطوط مختلف رسم کنید‪.‬‬
color style marker
 A color style marker is a 1, 2, or 3character. It may
consist of
a color type,
a line style type,
a marker type
 Color strings are ’c’, ’m’, ’y’, ’r’, ’g’, ’b’, ’w’ and
’k’. These correspond to cyan, magenta, yellow, red,
green, blue, white, and black.
Line style marker and marker types
 Line style strings are ’-’ for solid, ’--’ for dashed,
’:’ for dotted, ’-.’ for dash-dotted and ’none’ for no
line.
 The most common marker types include ’+’, ’o’,
’*’ , ‘s’ ,’>and ’x’.
Example:the statement plot(x1,y1,’b:*’)
Figure Window
 The plot function automatically opens a figure
window to plot the graphic.
 If there is already an existing figure window, this
windows will be used for the new plot
 The command figure can be used to keep an
existing figure window and open a new one, which
will be used for the next plot
The hold on command keeps the content of the
figure and plots can be added.
hold can be used to toggle between on and
off.
hold off ends the hold on status of a figure window.
Controlling Axes
The axis function overwrites this default by setting
custom axis limits,
axis([xmin xmax ymin ymax])
To take a closer look at an interesting part of a
plot, the zoom command can be used.
The grid command is used to turn a grid on and
off.
Controlling Axes
xlim, ylim, zlim
To control the upper and lower axis limits on a
graph, use the Property Editor, one of the plotting
tools .
xlim([xmin xmax])
Subplot
subplot(m,n,p) or subplot(mnp)
subplot divides the current figure into rectangular
panes that are numbered row wise. Each pane
contains an axes object which you can manipulate
Semilogy
semilogy plots data with logarithmic scale for
the y-axis.
Semilogx
semilogy plots data with logarithmic scale for
the x-axis
Loglog
Scaterplot(x+iy)
scatterplot(x) produces a scatter plot for the
signal x
If x is a complex vector, scatterplot interprets the
real part as in-phase components and the
imaginary part as quadrature components.
If x is a real vector, scatterplot interprets it as a
real signal.
h = gca
returns the handle to the current axes for the
current figure. If no axes exists, the MATLAB
software creates one and returns its handle.
The current axes is typically the last axes used for
plotting or the last axes clicked on by the mouse.
h = gcf returns the handle of the current figure. The
current figure is the figure window in which
graphics commands such as plot, title, and surf draw
their results.
If no figure exists, the MATLAB software creates
one and returns its handle. You can use the
statement get(0,'CurrentFigure')
h=clf
clf deletes from the current figure all graphics
objects
Findobj
Locate graphics objects with specific properties
‫رسم توابع گرافیکی گسسته‬
‫با استفاده از دستور ‪ stem‬تابع سینوس را در فواصل ‪0.1‬‬
‫بصورت گسسته در فاصله ‪ 0‬تا ‪ 2 ‬رسم کنید‬
‫با بکارگیری رنگ های مناسب دوتابع‬
‫نمایی‪0 . 7‬‬
‫‪e‬‬
‫با ضریب ‪0.5‬و‬
‫ضریب ‪ 0.7‬را به ترتیب در کسینوس ‪ x‬ضرب و آنها در در بازه‬
‫‪ 0:25‬و آنها را دیک دستگاه مقایسه کنید‪.‬‬
Flow control The axis function
The flow control is based on decision making
structures.
Some of the most important structures are
for-loop,
 while-loop
if-else-end-
random
Random numbers
Syntax
Y = random(name,A)
Y = random(name,A,B)
Y = random(name,A,B,C)
Y = random(...,m,n,...)
Y = random(...,[m,n,...])
Description
Y = random(name,A) where name is the name of
a distribution that takes a single parameter, returns
random numbers Y from the one-parameter family of
distributions specified by name. Parameter values for
the distribution are given in A.
Y is the same size as A.
Description
Y = random(name,A,B) returns random numbers Y
from a two-parameter family of distributions.
Parameter values for the distribution are given in A
and B.
If A and B are arrays, they must be the same size. If
either A or B are scalars, they are expanded to
constant matrices of the same size.
Description
Y = random(name,A,B,C) returns random
numbers Y from a three-parameter family of
distributions. Parameter values for the
distribution are given in A, B, and C.
If A, B, and C are arrays, they must be the
same size. If any of A, B, or C are scalars, they
are expanded to constant matrices of the same
size.
Description
Y = random(...,m,n,...) or Y= random(...,[m,n,...])
returns an m-by-n-by... matrix of random
numbers.
If any of A, B, or C are arrays, then the specified
dimensions must match the common
dimensions of A, B, and C after any necessary
scalar expansion.
Examples
Generate a 2-by-4 array of random values from the
normal distribution with mean 0 and standard
deviation 1:
x1 = random('Normal',0,1,2,4)
x1 =
1.1650 0.0751
-0.6965
0.6268 0.3516 1.6961
0.0591
1.7971
Examples
Generate a single random value from Poisson
distributions with rate parameters 1, 2, ..., 6,
respectively:
x2 = random('Poisson',1:6,1,6)
x2 = 0 0 1 2 5 7
‫‪ 1000 -1‬عدد تصادفی با توزیع نرمال تولید و به کمک توابع‬
‫‪ Plot‬و ‪ hist‬این اعداد را نمایش داده و تفاوت این دو نوع‬
‫نمایش را بیان کنید‪.‬‬
‫‪ -2‬مسئله فوق را برای ‪ 1000‬عدد تصادفی با توزیع گوس ی‬
‫میانگین ‪ 3‬و واریانس ‪ 5‬تکرار کنید‪.‬‬
‫‪ 1000 -1‬عدد تصادفی با توزیع نرمال تولید و به کمک توابع‬
‫‪ Plot‬و ‪ hist‬این اعداد را نمایش داده و تفاوت این دو نوع‬
‫نمایش را بیان کنید‪.‬‬
‫‪ -2‬مسئله فوق را برای ‪ 1000‬عدد تصادفی با توزیع گوس ی‬
‫میانگین ‪ 3‬و واریانس ‪ 5‬تکرار کنید‪.‬‬
pdf
Probability density functions Syntax
Y = pdf(name,X,A)
Y = pdf(name,X,A,B)
Y = pdf(name,X,A,B,C)
Description
Y = pdf(name,X,A) computes the probability density
function for the one-parameter family of distributions
specified by name. Parameter values for the
distribution are given in A. Densities are evaluated at
the values in X and returned in Y.
Description
If X and A are arrays, they must be the same
size. If X is a scalar, it is expanded to a constant
matrix the same size as A. If A is a scalar, it is
expanded to a constant matrix the same size as
X. Y is the common size of X and A after any
necessary scalar expansion.
Description
Y = pdf(name,X,A,B) computes the probability
density function for two-parameter families of
distributions, where parameter values are
given in A and B.
Description
Y = pdf(name,X,A,B,C) computes the probability
density function for three-parameter families of
distributions, where parameter values are given in
A, B, and C.
Examples
Compute the pdf of the normal distribution with mean 0
and standard deviation 1 at inputs –2, –1, 0, 1, 2:
p1 = pdf('Normal',-2:2,0,1)
p1 = 0.0540 0.2420 0.3989 0.2420 0.0540
The order of the parameters is the same as for normpdf.
Compute the pdfs of Poisson distributions with rate
parameters 0, 1, ..., 4 at inputs 1, 2, ..., 5, respectively:
p2 = pdf('Poisson',0:4,1:5)
p2 = 0.3679 0.2707 0.2240 0.1954 0.1755
‫‪ -1‬تابع احتمال ‪ pdf‬را برای توزیع نرمال استاندارد از ‪-3:3‬‬
‫بدست آورده و با تابع مناسب رسم کنید‪.‬‬
‫‪ -2‬مسئله فوق را برای ‪ 1000‬عدد تصادفی با توزیع گوس ی‬
‫میانگین ‪ 3‬و واریانس ‪ 5‬تکرار کنید‪.‬‬
‫‪ -3‬با تابع توزیع یکنواخت ‪ 1000‬عدد تصادقی تولید کنید‪.‬‬
‫‪ -1‬تابع احتمال ‪ pdf‬را برای توزیع نرمال استاندارد از ‪-3:3‬‬
‫بدست آورده و با تابع مناسب رسم کنید‪.‬‬
‫‪ -2‬با تابع توزیع یکنواخت ‪ 1000‬عدد تصادقی تولید کنید‪.‬‬
‫‪ -3‬با داشتن پارامترهای شکل دهی و پارامترهای مقیاس ‪ 1‬و ‪10‬‬
‫صد عدد با توزیع گاما تولید کنید‪.‬‬
‫‪ -4‬تابع احتمال ‪ pdf‬را برای حالت فوق از ‪ 1‬تا ‪ 4‬بدست‬
‫آورده و رسم کنید‪.‬‬
‫‪ Unipolar‬یا تک قطبی‬
‫این روش کد گذاری از تمام روشها ساده تر است‪ .‬به این صورت‬
‫که برای ارسال سیگنال از ولتاژ صفر برای نشان دادن صفر و از‬
‫ولتاژ باال یا پایین (یکی از پالریته ها) برای نشان دادن یک استفاده‬
‫میشود‪ .‬این روش به دلیل استفاده از تنها یک پالریته‪ ،‬تک قطبی‬
‫نام گرفته است‪.‬‬
NRZ-L: Non-return to zero level
This is the standard positive logic signal
format used in digital circuits.
1 forces a high level
0 forces a low level
‫تمرین‪:‬‬
‫يك بسته اطالعاتي حاوي ‪ 20‬بيت اطالعات است‪.‬‬
‫‪ .1‬ابتدا اين بسته را توليد كنيد‪.‬‬
‫‪ .2‬بيت هاي صفر و يك را نمايش دهيد‬
‫‪ .3‬اين اطالعات را به روش ‪ Bipolar‬با سطح ولتاژ ‪ 0‬و ‪ -5v‬با‬
‫نرخ ارسال ‪1mb/s‬براي ارسال آماده كنيد‪.‬‬
‫‪ .4‬اطالعات كد شده به روش فوق را نمايش دهيد‪.‬‬
‫تمرین‪:‬‬
‫‪ .1‬اطالعات فوق را به روش ‪ polar‬با سطح ولتاژ ‪ +5v‬و ‪ -5v‬با‬
‫نرخ ارسال ‪1mb/s‬براي ارسال آماده كنيد‪.‬‬
‫‪ .2‬اطالعات كد شده به روش فوق را با حالت قبل به شكل‬
‫مقايسه نمايش دهيد‪.‬‬
NRZ-M ‫کد خط‬
NRZ –M Non Return to Zero
-Mark (0no change, 1 change)
Non-return to zero mark
1 forces a transition
0 does nothing
‫تمرین‪:‬‬
‫‪ .1‬اطالعات فوق را به روش ‪NRZ-L‬با سطح ولتاژ ‪ +5v‬و ‪-5v‬‬
‫با نرخ ارسال ‪1mb/s‬براي ارسال آماده كنيد‪.‬‬
‫‪ .2‬اطالعات كد شده به روش فوق را با بيتهاي توليدي به شكل‬
‫مقايسه نمايش دهيد‪.‬‬
RZ: Return to zero
1 goes high for half the bit period
0 does nothing
AMI : Alternate Mark Inversion
AMI is another example of a bipolar line
code. Each successive mark is inverted and
the average or DC level of the line is
therefor zero.
‫مدوالسیون ‪AM‬‬
‫در این مدوالسیون دامنه سیگنال حامل بصورت تابعی از سیگنال‬
‫ورودی تغییر می کند‪.‬‬
‫انواع مدوالسیون ‪AM‬‬
‫‪DSB_AM‬‬
‫‪SSB-AM‬‬
‫‪VSB-AM‬‬
‫خصوصیت ‪AM‬‬
‫‪ -1‬پهنای باند مورد نیاز کم‪ ،‬این پهنای باند بین ‪ W‬و ‪ 2W‬تغییر می‬
‫کند ‪ W .‬پهنای باند سیگنال پیام است‬
‫‪-2‬بازده توان پایین در مقایسه با مدوالسیون زاویه‬
‫نمایش حوزه ی زمانی سیگنال مدوله شده عبارت است از ‪:‬‬
‫)‪u(t)=Acm(t)cos(2fct‬‬
‫که در آن )‪c(t‬سیگنال حامل‬
‫) ‪c(t)=Accos(2fct‬‬
‫و )‪ m(t‬سیگنال پیام است‪.‬‬
‫نمایش حوزه ی فرکانس سیگنال ‪ DSB-AM‬با محاسبه ی تبدیل‬
‫فوریه )‪u(t‬به دست می آید ‪:‬‬
‫)‪U(f)= Ac/2M(f-fc)+Ac/2M(f+fc‬‬
‫در این نوع مدوالسیون جابجایی به اندازه ‪ fc‬وتغییر مقیاس به‬
‫اندازه ‪ Ac/2‬را داریم‪.‬‬
‫پهنای باند انتقالی دو برابر پهنای باند پیام است‪.‬‬
‫توان موجود در سیگنال مدوله شده از روابط محاسبه توان بدست‬
‫می آید‪:‬‬
‫‪T u t  dt‬‬
‫‪2‬‬
‫‪1‬‬
‫‪p  lim‬‬
‫‪T‬‬
‫‪T ‬‬
‫‪2‬‬
‫‪Pm‬‬
‫که در آن ‪ Pm‬توان سیگنال پیام است‪.‬‬
‫‪Ac‬‬
‫‪2‬‬
‫‪‬‬
‫مثال‬
‫سیگنال پیام )‪m(t‬به صورت زیر تعریف می شود این پیام حامل‬
‫‪C(t)=cos2fct‬را به روش ‪DSB-Am‬مدوله میکند‪ .‬فرض می‬
‫شود که ‪t0=0.15‬‬
‫و ‪fc=25 0HZ‬‬
‫‪-1‬معادله )‪ u(t‬به دست آورید‪.‬‬
‫‪-2‬طیفهای )‪u(t‬و)‪ m(t‬را به دست آورید‪.‬‬
‫‪-3‬بافرض این که سیگنال پیام متناوب با دوره تناوب ‪T0=t0‬توان‬
‫سیگنال مدوله شده را تعیین کنید‬
1-Generate a Random Binary
Generate a Random Binary Data Stream.
The conventional format
The randint function to create a column vector
that lists the successive values of a binary data
stream
Plot first 40 bits in a stem plot.
2. Prepare to Modulate
Bit-to-Symbol Mapping
each M-bits of values from bits that generated
befor is set in a a row of a matrix,
apply the bi2de function to convert each Mtuple to a corresponding integer
3. Modulate Using M-QAM.
modem.qammod
modem.mskmod
modem.pskmod
modem.pammod
modem.qammod
Syntax
h = modem.qammod(M)
h = modem.qammod(M, phaseoffset)
h = modem.qammod(property1, value1, ...)
h = modem.qammod(QAMdemod_object)
h = modem.qammod(QAMdemod_object, property1,
value1, ...)
h = modem.qammod
Description
The modem.qammod function creates a modulator
object that you can use with the modulate method
to modulate a signal.
h = modem.qammod(M) constructs a QAM modulator object h for
M-ary modulation.
h = modem.qammod(M, phaseoffset) constructs a QAM modulator
object h whose constellation has a phase offset of phaseoffset
radians.
h = modem.qammod(property1, value1, ...) constructs a QAM
modulator object h with properties as specified by the
property/value pairs. See the following section on properties.
h = modem.qammod(QAMdemod_object) constructs a QAM
modulator object h by reading the property values from the QAM
demodulator object, QAMdemod_object. The properties that are
unique to the QAM modulator object are set to default values.
h = modem.qammod(QAMdemod_object, property1, value1, ...)
AND…..
h = modem.qammod
constructs a QAM
modulator object h with default properties.
It constructs a modulator object for 16-QAM
modulation and is equivalent to:
h = modem.qammod('M', 16, 'PhaseOffset', 0,
'SymbolOrder',... 'binary', 'InputType', 'integer')
Type of mapping employed for mapping symbols to
ideal constellation points. The choices are 'binary'
(binary mapping), 'gray' (Gray mapping), and 'userdefined' (custom mapping). Default is 'binary'.
Type of input to be processed by the QAM
modulator object. The choices are 'bit' (bit/binary
output), and 'integer' (integer/symbol output).
Default is 'integer'.
4-Add White Gaussian Noise
Applying the awgn function to the modulated
signal adds white Gaussian noise to it.
Create a Scatter Plot
Applying the scatterplot function to the
transmitted and received signals shows what the
signal constellation looks like and how the noise
distorts the signal. In the plot, the horizontal axis is
the in-phase component of the signal and the
vertical axis is the quadrature component. The
code below also uses the title, legend, and axis
functions in MATLAB to customize the plot.
6. Demodulate Using 16-QAM.
Applying the demodulate method of the
modem.qamdemod object to the received signal
demodulates it. The result is a column vector
containing integers between 0 and 15.
7. Convert the Integer-Valued Signal
to a Binary Signal
The previous step produced zsym, a vector of
integers. To obtain an equivalent binary signal,
use the de2bi function to convert each integer
to a corresponding binary tuple along a row of
a matrix. Then use the reshape function to
arrange all the bits in a single column vector
rather than a four-column matrix.
8. Compute the System’s BER
Applying the biterr function to the original
binary vector and to the binary vector from the
demodulation step above yields the number of
bit errors and the bit error rate.
9.Annotate the Plot to Indicate
the Mapping
To annotate the plot to show the relationship
between mapping and pt, use the text function to
place a number in the plot beside each constellation
point.
text(x , y , 'string')
Example
text(real(symbol_mod)+0.1,imag(symbol_mod),dec2bin(symbol))
Gray codes
Gray-coded signal constellation, then the
annotations for each pair of adjacent points would
differ by one bit.
Example
h=modem.qammod('M', M , 'Symbolorder‘ , 'gray')
‫مثال‬
‫برنامه ای بنویسید که عمل مدوالسیون ‪ 16-QAM‬را روی یک‬
‫سیگنال تصادفی انجام داده سپس با عبور از سیگنال دمدوله شده از‬
‫یک کانال ‪ AWGN‬آن را دمدوله کرده و نرخ خطای بیت را‬
‫محاسبه نماید‪.‬‬
‫نمودار سیگنال مدوله شده و آلوده شده به نویز را نمایش دهید‪.‬‬
Pulse shaping
In electronics and telecommunications, pulse shaping is the
process of changing the waveform of transmitted pulses. Its
purpose is to make the transmitted signal better suited to its
purpose or the communication channel, typically by limiting
the effective bandwidth of the transmission. By filtering the
transmitted pulses this way, the intersymbol interference
caused by the channel can be kept in control. In RF
communication, pulse shaping is essential for making the
signal fit in its frequency band.
fdesign.pulseshaping
Pulse-shaping filter specification object
Syntax
d = fdesign.pulseshaping
d = fdesign.pulseshaping(sps)
d = fdesign.pulseshaping(sps,shape)
d = fdesign.pulseshaping(sps,shape,spec,value1,value2,...)
d = fdesign.pulseshaping(...,fs)
d = fdesign.pulseshaping(...,magunits)
d = fdesign.pulseshaping
constructs a specification object d, which can be used to
design a minimum-order raised cosine filter object with a stop
band attenuation of 60dB and a rolloff factor of 0.25.
Response: 'Pulse Shaping‘
PulseShape: 'Raised Cosine'
SamplesPerSymbol: 8
Specification: 'Ast,Beta‘
Description: {'Stopband Attenuation (dB)'; 'Rolloff Factor'}
NormalizedFrequency: true
Astop: 60
RolloffFactor: 0.25
d = fdesign.pulseshaping(sps)
constructs a minimum-order raised cosine filter specification
object d with a positive integer-valued oversampling factor,
Samples Per Symbol .
Sps= Samples Per Symbol
Response: 'Pulse Shaping‘
PulseShape: 'Raised Cosine'
SamplesPerSymbol:3
Specification: 'Ast,Beta‘
Description: {'Stopband Attenuation (dB)'; 'Rolloff Factor'}
NormalizedFrequency: true
Astop: 60
RolloffFactor: 0.25
d = fdesign.pulseshaping(sps,shape)
constructs d where shape specifies the PulseShape
property. Valid entries for shape are:
'Raised Cosine'
‘Square Root Raised Cosine'
'Gaussian'
d=
fdesign.pulseshaping(sps,shape,spec,va
lue1,value2,...)
constructs d where spec defines the Specification properties.
The string entries for spec specify various properties of the
filter, including the order and frequency response. Valid
entries for spec depend upon the shape property. For 'Raised
Cosine' and 'Square Root Raised Cosine' filters, the valid
entries for spec are:
'Ast , Beta' (minimum order; default)
'Nsym , Beta'
'N , Beta'
Pulse Shaping Using a Raised
Cosine Filter
Problem :
Modify the Gray-coded modulation example so that
it uses a pair of square root raised cosine filters to
perform pulse shaping and matched filtering at the
transmitter and receiver, respectively
Functions
rcosine
function
To design the square root raised cosine filter
rcosflt
function
To filter the signals
Raised Cosine Filter
The raised-cosine filter is a filter frequently used for
pulse-shaping in digital modulation due to its ability to
minimize intersymbol interference (ISI).
The raised-cosine filter is an implementation of a lowpass Nyquist filter, i.e., one that has the property of
vestigial symmetry. This means that its spectrum exhibits
odd symmetry about , where is the symbol-period of the
communications system
Roll off factor
Its frequency-domain description is a piecewise
function, given by:
The width of the middle frequencies are defined by the roll off factor
constant Beta, (0< Beta <=1).
T, the reciprocal of the symbol-rate.
Impulse response
The impulse response of such a filter is given by:
‫مراحل انجام کار‬
‫برای شبیه سازی اثر این فیلترها بر روی یک رشته داده مدوله‬
‫شده ی ‪ x‬باید ابتدا رشته را با نرخ ‪ n‬برابر ‪ upsample‬کرد‪.‬‬
‫;)‪y= upsample(x,n‬‬
‫سپس به کمک دستور زیر آن را از فیلتر طراحی شده عبور داد‬
‫)‪r=filter(rcosFlt,y‬‬
‫در نهایت ‪ ،‬جهت نمونه برداری از سیگنال دریافتی در گیرندخ با‬
‫انحراف زمانی ‪ time offset‬از دستور زیر استفاده می کنیم‬
‫در نهایت ‪ ،‬جهت نمونه برداری از سیگنال دریافتی در گیرنده با‬
‫انحراف زمانی ‪ time offset‬از دستور زیر استفاده می کنیم‬
‫)‪Z=downsample(r,n,timeoffset‬‬
‫مجموعه دستورات طراحی فیلتر‬
:‫برای طراحی فیلتر از مجموعه دستورهای زیر استفاده می کنیم‬
•fdesign.pulseshaping(sps,shape,spec,value1,value2,...)
:‫مثال‬
sps=sample per symbol
)T ‫(تعداد نمونه های فیلتر در زمان‬
Shape=‘Raised Cosine’
Spec=‘Nsym,beta’
Value=Nsym
)T ‫(طول پنجره مشاهده پالس بر حسب‬
Value=beta (beta is rollfactor)
‫مجموعه دستورات طراحی فیلتر‬
‫)‪•rcosFlt=design(rcosSpec‬‬
‫‪•rcosFlt.Numerator=rcosFlt.Numerator/max(rcosFlt.Numerat‬‬
‫)‪or‬‬
‫دستور آخر دامنه حداکثر فیلتر را برابر یک قرار می دهد‪.‬‬
‫چنینن فیلتری یک فیلتر ‪ FIR‬با تعداد ‪ samplePerSym*Nsym+1‬نمونه و‬
‫دارای تاخیر ‪ samplePerSym*Nsym/2‬است‪.‬‬
‫تاثیر ‪rolloff‬‬
‫با افزایش مقدار فاکتور ‪ Rolloff‬عملکرد سیستم در برابر خطای‬
‫زمانی بهبود می یابد که به قیمت استفاده از عرض باند بیشتر‬
‫است‪.‬‬
‫كدگذاري كانال‬
‫از این روش براي محافظت اطالعات ارسالي در برابر خطاهاي‬
‫احتمالي بكار مي رود‪.‬‬
‫در این روش با اضافه كردن اطاعات به اطالعات اصلي سعي‬
‫مي شود كه خطاهاي بوجود آمده را شناسایي و تصحیح كرد‪.‬‬
‫اجزاي تشكیل دهنده یك كدر‬
‫‪ -1‬ورودي‬
‫)‪(k‬‬
‫‪ -2‬خروجي‬
‫)‪(n‬‬
‫‪ -3‬حافظه‬
‫‪ -4‬جمع كننده حافظه‬
‫روش هاي كالسیك كدگذاري‬
‫‪ -1‬كدهاي كانولوشنال‬
‫‪ -2‬كدهاي بلوكي‬
‫كدهاي كانولوشنال‬
‫این كدها از دسته كدهاي خطي داراي حافظه هستند‪.‬‬
‫یك كد كانولوشنال به شكل )‪ (n , k , m‬هستند كه در آن‬
‫‪ n‬تعداد بیت هاي خروجي‬
‫‪ k‬تعداد بیت هاي ورودي‬
‫‪ k*m‬حافظه مي باشد‬
‫‪ N‬بیت خروجي تركیبي خطي از ‪ k‬بیت ورودي و ‪ k*m‬حافظه‬
‫است‬
‫حداكثر تعداد حافظه سر راه هر ورودي برابر ‪ m‬است به همین‬
‫تعداد حافظه ها در یك سیستم كدینگ ‪ k*m‬است‬
‫‪ K=m+1‬در اصطالح طول قید كد نام دارد‪.‬‬
‫‪ R=k/n‬نرخ كد است‪.‬‬
‫كدهاي بازگشتي و غیر بازگشتي‬
‫اگر مقدار جدید اولین عنصر حافظه برابر ورودي متناظر با آن‬
‫باشد ‪ ،‬كد غیر بازگشتي نام دارد‬
‫اگر مقدار جدید اولین عنصر حافظه برابر جمع ورودي متناظر با‬
‫آن حافظه با تركیب خطي از مقدارهاي دیگر عناصر آن حافظه‬
‫باشد ‪ ،‬كد بازگشتي نام دارد‬
‫سیستماتیك و غیر سیتماتیك‬
‫در كد سیستماتیك‪ ،‬رشته ورودي عینا در خروجي ظاهر مي شود‪.‬‬
‫در كد غیر سیستماتیك‪ ،‬رشته ورودي عینا در خروجي ظاهر نمي‬
‫شود‪.‬‬
‫توجه‪ :‬در عمل معموال یا از كدهاي غیر بازگشتي و غیر‬
‫سیستماتیك و یا كدهاي بازگشتي و سیستماتیك استفاده مي شود‪.‬‬
‫معرفي یك كد كانولوشنال غیر بازگشتي‬
‫)‪trellis = poly2trellis(ConstraintLength,CodeGenerator‬‬
‫‪ :ConstraintLength,‬برداري به طول ‪ k,‬است‪ ،‬بردار مربوطه ضرائب طول قید‬
‫هر كدام از ورودي ها مي باشد‪.‬‬
‫‪ : CodeGenerator:‬ماتریس ‪ k*n‬است كه ضرائب اتصال حافظه ها به جمع كننده‬
‫هاي تولید كننده ي خروجي را با نمایش اكتال تعیین مي كند‪.‬‬
‫عنصر )‪ (I,j‬مشخص كننده نحوه اتصال حافظه مربوط به ورودي ‪i‬ام به جمع كننده ‪j‬‬
‫ام است‪.‬‬
‫براي نشان دادن نمایش اكتال نمایش باینري را سه رقم به سه رقم از سمت راست در‬
‫نظر مي گیریم‬
‫مثال‪(33)8=11011 :‬‬
‫معرفي یك كد كانولوشنال بازگشتي‬
trellis = poly2trellis(ConstraintLength,CodeGenerator,...
FeedbackConnection)
‫ است كه ضرائب‬k ‫ برداري به طول‬:FeedbackConnection
.‫برگشتي مربوط به هر حافظه را تعیین مي كند‬
‫مثال‬
(2,1,4) ‫كد كانولوشنال‬
trellis = poly2trellis(ConstraintLength,CodeGenerator,...
FeedbackConnection)
Constraint length: 5
Generator polynomial pair: [37 33]
[11111 11011]
Feedback polynomial: 37 [11111]
trellis = poly2trellis(5,[37,33],37)
Fields of the Output Structure
trellis for a Rate k/n Code
‫‪K=2‬‬
‫‪N=3‬‬
‫‪Rate=2/3‬‬
‫]‪Constraint length=[5,4‬‬
‫=)‪CodeGenerator:(2*3‬‬
‫تعداد جمع كننده ها =‪3‬‬
‫ماتریس ‪ 2*3‬فوق ورودي به جمع كنندها مي باشد‪.‬‬
‫جمع كننده دوم‬
‫جمع كننده اول‬
‫جمع كننده سوم‬
‫‪0‬‬
‫‪11101‬‬
‫‪10011‬‬
‫‪1011‬‬
‫‪101‬‬
‫‪0‬‬
‫]‪CodeGenerator=[23 35 0 ; 0 5 13‬‬
‫‪Punctructed code‬‬
‫اگر همه بیت هاي كد شده توسط كد كننده ارسال نشود‪ ،‬كد مورد‬
‫نظر كد هرس شده است‪.‬‬
‫توسط یك بردار ‪ n*p‬كه حاوي ‪ 0‬و ‪ 1‬است مي توان فهمید كه بیت‬
‫خروجي ‪ i‬در ‪j‬امین دسته از بیت هاي خروجي آیا ارسال مي شود‬
‫یا خیر‬
‫صفر بودن عناصر ماتریس فوق نشان دهنده ارسال است‪.‬‬
‫حداقل وزن همینگ‬
‫این پارامتر نوانایي یك كد را در تشخیص و تصحیح خطا نشان مي دهد‪.‬‬
‫این پارامتر در یك كد كانولوشنال وزن آزاد كد نام دارد كه از مشخصه‬
‫توزیع وزني بدست مي آید‪.‬‬
‫توزیع وزني ورودي خروجي یك كد مجم‪.‬عه ضرایب ‪ Aij‬است كه در‬
‫آن ‪ Aij‬نشان دهنده تعداد كلمه هاي كد با وزن ‪ j‬است كه از كد كردن‬
‫كلمه هاي اطالعات با وزن ‪ i‬بدست مي آید‪.‬‬
‫پس كوچكترین مقدار ‪ j‬كه به ازاي آن حداقل یكي از مقادیر ‪Aij‬‬
‫مخالف صفر است ‪ ،‬وزن آزاد كد مي باشد‪.‬‬
Spect=distspec(trellis,n)
‫روش كد كردن‬
code = convenc(msg,trellis)
code = convenc(msg,trellis,puncpat)
code = convenc(msg,trellis,...,init_state)
[code,final_state] = convenc(...)
‫دستور اول رشته باینري ‪ msg‬را با كدري به نام ‪ trelis‬كه‬
‫مشخصات آن را تعریف نمودیم كد كرده و در ‪ code‬جایگذاري‬
‫مي كند‪ .‬كد كننده در شروع در حالت صفر قرار دارد‪.‬‬
‫در حالت دوم كد توسط بردار ‪ puncpat‬بریده مي شود‪.‬‬
‫در دستور سوم حالت اولیه كد الزاما صفر نیست و ورودي آخر‬
‫حالت اولیه كد كننده را مشخص میسازد‬
‫دستور چهارم ‪ ،‬حالن نهایي كد كننده را نیز به ما مي دهد‪.‬‬
‫الگوریتم ویتربي‬
.‫استفاده مي شود‬vitdec ‫براي كد برداري از یك رشته كد شده از دستور‬
decoded = vitdec(code,trellis,tblen,opmode,dectype)
decoded = vitdec(code,trellis,tblen,opmode,'soft',nsdec)
decoded = vitdec(code,trellis,tblen,opmode,dectype,puncpat)
decoded =
itdec(code,trellis,tblen,opmode,dectype,puncpat,eraspat)
decoded =vitdec(...,'cont',...,initmetric,initstates,initinputs)
[decoded,finalmetric,finalstates,finalinputs] = ...
vitdec(...,'cont',...)
‫تمامی این دستورها با استفاده از الگوریتم ویتربی عملیات دکدینگ را انجام‬
‫می دهند‪.‬‬
‫‪ : Cod:‬رشته بیت کد شده‬
‫‪ :Trellis‬کد کننده زمان کدینگ تعریف شده است‬
‫‪ :Tblen‬بر حسب تعداد سمبل های ورودی و خروجی کد کننده‪.‬‬
‫هر سمبل در ورودی کد کننده برابر ‪ k‬بیت و در خروجی برابر ‪ n‬بیت است‪.‬‬
‫مثال‪ :‬برای کدینگ با نرخ ½ مقدار نوعی عمق دیکدینگ ‪ 5‬برابر طول قید‬
‫کد است‪.‬‬
‫‪ : opmod‬این ورودی متنی است و یکی از سه مقدار زیر را داراست‬
‫’‪ : ‘trunc‬در این حالت فرض می شود کد کننده از حالت صفر شروع‬
‫به کار کرده است‬
‫’‪ : ‘term‬در این حالت فرض می شود کد کننده از حالت صفر شروع‬
‫بکار کرده است و در حالت صفر به کار خود پایان داده است‬
‫’‪ :‘count‬در این حالت کد برداری بصورت پیوسته انجام می شود ‪ .‬به‬
‫اندازه عمق کد برداری در خروجی تاخیر وجود دارد‪.‬‬
‫‪ :dectype‬نحوه محاسبه متریک در الگوریتم را مشخص می کند‬
‫که یکی از مقادیر زیر را دارد‬
‫’‪ :‘hard‬در این حالت بر اساس فاصله همینگ محاسبات انجام می شود‪.‬‬
‫ورودی کد در این حالت باید از نوع صفر و یک باشد‪ .‬به این حالت سخت‬
‫تصمیمی می گویند‬
‫’‪ :‘unquant‬در این حالت بر اساس فاصله اقلیدسی رشته دریافتی با مقدار‬
‫‪ +1‬به ازای صفر منطقی و ‪ -1‬به ازای یک منطقی بررسی می شوند‪.‬‬
‫ورودی کد به شکل عددی است و اعداد منفی نماینده بیت یک و اعداد مثبت‬
‫نمایتده بیت صفر هستند‪ .‬به این حالت نرم تصمیمی گفته می شود‪.‬‬
‫’‪ :;soft‬در این حالت دقت محاسبه بستگی به تعداد بیت هایی است‬
‫که برای محاسبه در نظر می گیریم‪ .‬این نوع کد برداری در عمل‬
‫مرسوم است‪.‬‬
‫در صورت استفاده از این حالت باید از دستور دوم ‪ vitdec‬استفاده‬
‫گردد‪.‬‬
‫در دستور دوم ‪ nsdec‬نشان دهنده تعداد بیت های در نظر گرفته‬
‫شده در محاسبه است‪.‬‬
‫در دستور سوم ‪ puncpat‬نشان دهنده وجود هرس در حالت کد‬
‫شدن است‪.‬‬
‫در دستور چهارم عالوه بر مشخص نوع هرس می توان بیت های‬
‫پاک شده توسط ورودی های باینری ‪ eraspat‬تعیین نمود‪.‬‬
‫ابعاد این ورودی مانند ورودی کد است که در آن هر عنصر غیر‬
‫صفر نشان دهنده پاک شدن بیت متناظر با آن است‪.‬‬
‫مثال‬
‫فرض شود در یک سیستم مدوالسیون ‪ BPSK‬سیگنال دریافتی‬
‫دارای مقدار ‪ +1‬به ازای صفرمنطقی و ‪ -1‬به ازای یک منطقی‬
‫است‬
‫عملکرد سیستم را در دو حالت نرم تصمیم و سخت تصمیم مقایسه‬
‫کنید‪.‬‬