Sunteți pe pagina 1din 3

Breve guida per i principali comandi Matlab

La lista seguente comprende i comandi di Matlab usati nelle esercitazioni di laboratorio del corso di Fondamenti di Segnali e Trasmissione 2002/2003.

Control flow for variable = expression statements end while expression statements end if expression1 statements elseif expression2 statements else statements end switch switch_expr case case_expr statements case {case_expr1,case_expr2,case_expr3,...} statements ... otherwise statements end break 2for Repeat statements a specific number of times 2while Repeat statements an indefinite number of times Conditionally execute statements

2switch Switch among several cases based on a conditional expression

Terminate execution of for loop or while loop

Basic math functions round(X) fix(X) sign(X) rounds the elements of X to the nearest integers rounds the elements of X toward zero, resulting in an array of integers returns an array Y the same size as X, where each element of Y is: 1 if the corresponding element of X is greater than zero 0 if the corresponding element of X equals zero 1 if the corresponding element of X is less than zero returns the square root of each element of the array X Absolute value and complex magnitude Real part of complex number Imaginary part of a complex number Complex conjugate For complex z = x + j*y, it returns the complex exponential: ez = ex (cos(y) + j sin(y)) If X is a vector, returns the sum of the elements If X is a vector, returns the product of the elements returns the phase angles, in radians, for each element of complex array X. The angles lie between returns the natural logarithm of the elements of X

sqrt(X) abs(X) real(X) imag(X) conj(X) exp(z) sum(X) prod(X) angle(X) log(X)

log10(X) sin(X), cos(X), tan(X) asin(X), acos(X), atan(X)

returns the logarithm to the base 10 of the elements of X direct trigonometric functions inverse trigonometric functions

Matrix algebra length(X) size(X) find(X) returns the length of vector X returns the sizes of each dimension of array X returns the indices of the array x that point to nonzero elements

Waveform and data generation sinc(x) rand(M,N) randn(M,N) zeros(M,N) ones(M,N) returns the sinc of the elements of X, i.e. y = sin(pi*x)/(pi*x) if x ~= 0 and 1 if x == 0 generates arrays of random numbers whose elements are uniformly distributed in the interval (0,1) generates arrays of random numbers whose elements are ormally distributed with zero mean and unit variance. returns an M-by-N matrix of zeros returns an M-by-N matrix of ones

Statistical signal processing mean(x) std(X) min(X), max(X) mean value of the elements of vector X standard deviation of the elements of vector X smallest or largest element in vector X

Graphics plot(X,Y) loglog(X,Y) semilogy(X,Y), semilogx(X,Y) stem(Y) title(text) xlabel, ylabel, zlabel(text) plots vector Y versus vector X plots vector Y versus vector X using log-log scales plots vector Y versus vector X using a logarithmic (base 10) scale for the Yaxis or the X-axis respectively plots the data sequence Y as stems from the x axis terminated with circles for the data value title for 2D and 3D plots labels for x,y and z axis in 2D and 3D plots

Elenco delle funzioni matlab sviluppate in laboratorio

Impulso di Dirac Impulso triangolare Impulso rettangolare Impulso trapezoidale

fdirac=fdirac(t,timp) triang=tri(t,durata) x=trarect(t,media,durata) trapezio=trape(t,durM,durm)

Linea di ritardo FRC, filtro passa basso reale, a resistenza e capacit FCR, filtro a coseno rialzato sequenza periodica di impulsi di Dirac Somma di sinusoidi ,1 e 2

F_rit=rit(tau,f) [FRC,f]=FRC(tc,f) [FCR,f]=FCR(tc,alfa,f) fdirper=fdper(t,tc) sin_sig=sinus(t,n) sin_sig=sinus_rand(t,n) z=integra(x,t,ta,tb) [y,ty]=convolve(x,h,tx,th) [X,f]=forfft(x,t) [x,t]=backifft(X,f)

Integrazione Convoluzione Trasformata e Antitrasformata di Fourier

Pdf1 Bin_enc Bin_dec

[ddp,x_]=pdf1(x,n_,jplot) [out_binary] = bin_enc(in_quantized,no_bit) [out_quantized] = bin_dec(in_bin)

Passo

p=passo(x)

Generare una sequenza di bit equiprobabili Generare un segnale antipodale Generare un segnale campionante

S-ar putea să vă placă și