Translate
Bu Blogda Ara
26 Mayıs 2018 Cumartesi
Integration of a Function
clear all;
close all;
tin=0.15;
Fs=2000;
% Creating Discrete Signal
t1=0:1/Fs:tin/3;
t2=tin/3:1/Fs:2*tin/3;
t3=2*tin/3:1/Fs:tin;
len1=length(t1);
for i=1:len1
me1(i)=1;
me2(i)=-2;
me3(i)=0;
end
me=[me1 me2 me3];
t=[t1 t2 t3];
%///////////////////////////////
%Integration
integme=integro(me);
%//////////////////////////////////
figure(3);
plot(t,me);
title('Signal');
figure(4);
plot(t,integme);
title('Integral of Signal');
function reslt=integro(x)
Fs=2000;
dt=1/Fs;
result1=0;
for i=1:length(x);
result1=result1+(x(i)*dt);
result(i)=result1; %Store every point
%this array will give us the integral of
%signal
end
reslt=result;
end
Kaydol:
Kayıt Yorumları (Atom)
Amaizing
YanıtlaSilI hope it is beneficial for you.
Silbu integral biraz hatalı sanki
YanıtlaSilUpdated.Thanks for your feedback.
Sil