You are on page 1of 5

PRACTICA CALIFICADA

Pagina 45
c)

>> n = 0:6; x = [4,3,2,1,2,3,4];


>> w = [0:1:500]*pi/500;
>> X = dtft(x,n,w); magX = abs(X); phaX = angle(X);
>> % RESPUESTA DE MAGNITUD
>> subplot(2,1,1); plot(w/pi,magX);grid;
>> xlabel('frecuencia en pi unidades'); ylabel('|X|');title('Magnitude
Response');
>> % RESPUESTA DE FASE
>> subplot(2,1,2); plot(w/pi,phaX*180/pi);grid;
>> xlabel('frecuencia en pi unidades'); ylabel('Grados');

Dft
% senal

entrante

f = 50;
A = 5;
Fs = f*100;
Ts = 1/Fs ;
t=0:Ts:10/f;
y=A*sin(2*pi*f*t);
% senal entrante
% mix de senales
x1 = A * sin (2 * pi * (f + 50) * t);
x2 = A * sin (2 * pi * (f + 250) * t);
x = y + x1 + x2;
F = fft (x);

figure
plot(y)
figure
plot(x)
figure
N = Fs/length(F);
baxis=(1:N:N*(length(x)/2-1));
plot(baxis,real(F(1:length(F)/2)))
F2=zeros(length(F),1);
F2(10:11)=F(10:11);
xr=ifft(F2);
figure
plot(real(xr)),grid on

Ecg
% dtf Anlisis Espectral (DFT)
% 2
ecg=e1040552;
fs=500;
t=0:1/fs:12-1/500;
figure(1);
subplot(3,1,1);
plot(t,ecg);
grid;
xlabel('time[s]');
ylabel('magnitud[mv]');
title('pulso ecg con fs=500 hz')

%2
ecg2=ecg-mean(ecg);
t=0:1/fs:12-1/500;
figure(1);
subplot(3,1,2);
plot(t,ecg2);
grid;
xlabel('time[s]');
ylabel('magnitud[mv]');
title('pulso ecg con fs=500 hz');
%3
muestras=length(ecg2);
ordenadas=fft(ecg2,muestras);
%ordenadas=abs(ordenadas);
abscisas=linspace(0,fs,muestras);
figure(1);
subplot(3,1,3);
stem (abscisas,ordenadas);
grid;
xlabel('frecuencia ');
ylabel('magnitud[mv]');
title('analisis espectral(dominio

%4 contaminacion
t = 0:1/fs:12-1/500;
n1=125*sin(2*pi*50*t);
n2=125*sin(2*pi*80*t);
figure(2);

de la frecuencia)');

subplot(3,1,1);
plot(t,n1);
xlabel('time[s]');
ylabel('magnitud');
title('RUIDO');

ecgres=ecg2+n1+n2;
figure(2);
subplot(3,1,2);
plot(t,ecgres);
xlabel('time[s]');
ylabel('magnitud');
title('ecg contaminada');
%5
muestras =length(ecgres);
ordenadas=fft(ecgres,muestras);
ordenadas=abs(ordenadas);
abscisas=linspace(0,fs,muestras);
figure(2);
subplot(3,1,3);
stem(abscisas,ordenadas);
grid;
xlabel('frec(hz)');
title('analisis espectral a contaminada (dominio en la freucenica )');

You might also like