lab3_s&s_generacion de señales periodicasy aperiodicas

7
GENERACION DE SEÑALES PERIODICASY APERIODICAS t=linspace(0,10,100); y=sawtooth(t); plot(t,y) grid on t=linspace(0,2*pi,200); t1=(5/(2*pi))*t+5; y=sawtooth(t1); plot(t1,y) grid on y=sawtooth(t); plot(t1,y) grid on Incremento, ∆t= tft 0 N°puntos1

Upload: armando-cajahuaringa

Post on 09-Sep-2014

102 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lab3_S&S_Generacion de señales periodicasy aperiodicas

GENERACION DE SEÑALES PERIODICASY APERIODICAS

t=linspace(0,10,100);

y=sawtooth(t);

plot(t,y)

grid on

t=linspace(0,2*pi,200);

t1=(5/(2*pi))*t+5;

y=sawtooth(t1);

plot(t1,y)

grid on

y=sawtooth(t);

plot(t1,y)

grid on

Incremento, ∆ t=tf−t 0

N ° puntos−1

Page 2: Lab3_S&S_Generacion de señales periodicasy aperiodicas

t=linspace(0,2*pi,1000);

t1=(5/(2*pi))*t+5;

y=sawtooth(t);

plot(t1,y)

grid on

t=linspace(0,6*pi,500);

y=sawtooth(t);

t1=(15/(6*pi))*t+5;

plot(t1,y)

grid on

Page 3: Lab3_S&S_Generacion de señales periodicasy aperiodicas

t=linspace(0,6*pi,2000);

y=sawtooth(t);

t1=(15/(6*pi))*t+5;

plot(t1,y)

grid on

z=exp(y);

plot(t1,z)

p=y.*y;

plot(t1,p)

Page 4: Lab3_S&S_Generacion de señales periodicasy aperiodicas

y=sawtooth(t,0);

subplot(1,3,1)

plot(t1,y)

subplot(1,3,2)

y=sawtooth(t,1);

plot(t1,y)

subplot(1,3,3)

y=sawtooth(t,.4);

plot(t1,y)

Para generar 2 segundos de un pulso triangular (respectivamente rectangular) a una tasa de

muestra de 10 kHz (Δt =1/fs=0.0001) y un ancho de 20 ms, use:

fs = 10000;

t = -1:1/fs:1;

x1 = tripuls(t,20e-3);

x2 = rectpuls(t,20e-3);

subplot(211),plot(t,x1), axis([-0.1 0.1 -0.2 1.2])

xlabel('Tiempo (seg)');

ylabel('Amplitud');

title('Pulso Triangular Aperiodico')

subplot(212),plot(t,x2), axis([-0.1 0.1 -0.2 1.2])

xlabel('Tiempo (seg)');

ylabel('Amplitud');

title('Pulso Rectangular Aperiodico')

% set(gcf,'Color',[1 1 1]),

Page 5: Lab3_S&S_Generacion de señales periodicasy aperiodicas

-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1-0.2

0

0.2

0.4

0.6

0.8

1

Tiempo (seg)

Am

plitu

dPulso Triangular Aperiodico

-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1-0.2

0

0.2

0.4

0.6

0.8

1

Tiempo (seg)

Am

plitu

d

Pulso Rectangular Aperiodico

Formas de ondas periódicas

Además de las funciones sin y cos en MATLAB®, las herramientas ofrecen otras funciones que generan señales periódicas tales como diente de sierra y cuadrada.

La función sawtooth genera una onda diente de sierra con picos de ±1 con un periodo de 2*pi. Un parámetro opcional width especifica a múltiplo fraccional de 2*pi para el cual

ocurre los máximos de la señal.

La función square genera una onda cuadrada con un periodo of 2*pi. Un parámetro opcional especifica el duty cycle, el porcentaje del periodo para el cual la señal es positiva.

Para generar 1.5 segundos de una onda diente de sierra (respectivamente cuadrada) a 50 Hz (ancho de 1/50=0.02) con una tasa de muestreo de 10 kHz (incremento, 1/10 KHz=0.1 ms), use:

fs = 10000;

t = 0:1/fs:1.5;

x1 = sawtooth(2*pi*50*t);

x2 = square(2*pi*50*t);

subplot(211),plot(t,x1), axis([0 0.2 -1.2 1.2])

xlabel('Time (sec)');

ylabel('Amplitude');

title('Sawtooth Periodic Wave')

subplot(212),plot(t,x2), axis([0 0.2 -1.2 1.2])

xlabel('Time (sec)');

ylabel('Amplitude');

title('Square Periodic Wave')

Page 6: Lab3_S&S_Generacion de señales periodicasy aperiodicas

Código en matlab para generar tren de pulsos rectangulares

fc=2e9;

fs = 20e9; % sample freq

D = [2.5 10 17.5]' * 1e-9; % pulse delay times

t = 0 : 1/fs : 2500/fs; % signal evaluation time

w = 4e-9; % width of each pulse

yp = pulstran(t,D,@rectpuls,w);

if we plot this using matlab.. it will generate rectangular pulse train with amplitude varying from 0 to 1.. But how to modify this code so that it has to generate a pulse(amplitude) varying from (-1 to 1);

.. Please let me know how to modify.. is there any other method.

Respuesta: Únicamente agregue esta línea en el código.

yp=2*yp-1;

Muhammad Hanif