Diskretlash jarayonini Matlab dasturida qo‘yidagicha keltirish mumkin.
clear all;
close all;
clc;
%f=input(’Chastotani kiriting‘);
f=5;
%fs=input(’Diskretlash chastotasini kiriting‘);
fs=50;% Diskretlash chastotasi 50 hz
ts=1/50;
t=0:ts:1;% 50 ta diskret namuna
x1=sin(2*pi*f*t);% bu yerda f kiruvchi signal chastotasi
subplot(3,1,1);
plot(t,x1);
hold on;
plot(t,x1,’*’);
ylabel(’amplitude’);
xlabel(’title’);
title(’Diskretlash chastotasi 50 hz signal1’);
% Diskretlash chastotasi 25 hz
fs1=25;
ts1=1/25;
t1=0:ts1:1;
x2=sin(2*pi*f*t1);
subplot(3,1,2);
plot(t1,x2);
hold on;
plot(t1,x2,’*’);
ylabel(’amplitude’);
xlabel(’title’);
title(’Diskretlash chastotasi 25 hz signal1’);
% Diskretlash chastotasi 12.5 hz
fs2=12.5;
ts2=1/12.5;
t2=0:ts2:1;
x3=sin(2*pi*f*t2);
subplot(3,1,3);
plot(t2,x3);
hold on;
plot(t2,x3,’*’);
ylabel(’amplitude’);
xlabel(’title’);
title(’Diskretlash chastotasi 12.5 hz signal1’);
Do'stlaringiz bilan baham: |