Скачиваний:
46
Добавлен:
25.12.2019
Размер:
1.94 Кб
Скачать
clear all;
close all;

%Задание №1
X=0:0.02:2*pi;
Y=sin(3*X);
figure('Name','Signal','NumberTitle','off');
plot(X,Y, 'm');
title ('Signal');
hold on
Y2=2*cos(5*X);
plot(X,Y2, 'c');

%Задание №2
figure();
subplot(2,1,1);
plot(X,Y, 'm');
title ('Signal');
hold on
Y2=2*cos(5*X);
subplot(2,1,2);
plot(X,Y2, 'c');
clear all;


%Задание №3
F=30;
A=10;
Fs1=500;
Fs2=100;
tmax=0.1;
tmin=0;
T1=1/Fs1;
T2=1/Fs2;
t1=tmin:T1:tmax;
t2=tmin:T2:tmax;
Y1=A*cos(2*pi*F*t1);
figure('Name','Sinusoidal signal','NumberTitle','off');
plot(t1,Y1,'r');
hold on
Y2=A*cos(2*pi*F*t2);
plot(t2,Y2,'b');
clear all;

%Задание №4
F=30;
A=10;
Fs1=500;
Fs2=100;
tmax=0.1;
tmin=0;
T1=1/Fs1;
T2=1/Fs2;
t1=tmin:T1:tmax;
t2=tmin:T2:tmax;

figure('Name','Aliasing','NumberTitle','off');

subplot(3,1,1);
Y1Fs1=A*cos(2*pi*F*t1);
Y1Fs2=A*cos(2*pi*F*t2);
plot(t1,Y1Fs1,'r');
hold on
plot(t2,Y1Fs2,'b');

subplot(3,1,2);
Y2Fs1=A*cos(2*pi*(F+Fs2)*t1);
Y2Fs2=A*cos(2*pi*(Fs2-F)*t2);
plot(t1,Y2Fs1,'r');
hold on
plot(t2,Y2Fs2,'b');

subplot(3,1,3);
Y3Fs1=A*cos(2*pi*(Fs1)*t1);
Y3Fs2=A*cos(2*pi*(Fs2)*t2);
plot(t1,Y3Fs1,'r');
hold on
plot(t2,Y3Fs2,'b');
clear all;

%Задание №5
Fs=1200;
T=1/Fs;
Y=load('R1_06.txt');
LY=length(Y);
tmin=0;
tmax=LY*T;
K1=2; %коэффициент прореживания
F1s=Fs/K1;
T1=1/F1s;
t1=tmin:T1:tmax-T1;
LY1=LY/K1;
for i=1:LY1
Y1(i)=Y((i-1)*K1+1);
end
K2=25;
F2s=Fs/K2;
T2=1/F2s;
t2=tmin:T2:tmax-T2;
LY2=LY/K2;
for i=1:LY2
Y2(i)=Y((i-1)*K2+1);
end

figure('Name','ECG Without decimation/decimation','NumberTitle','off');

subplot(3,1,1);
t=tmin:T:tmax-T;
Yist=transpose(Y);
plot(t,Yist);

subplot(3,1,2);
plot (t1,Y1);

subplot(3,1,3);
plot (t2,Y2);
set(gca,'Ylim',[-1 2000]);


%appdesigner(Lab1_App_For_Task4);













Соседние файлы в папке Лаба 1