1_Spojité_signály
Níže je uveden pouze náhled materiálu. Kliknutím na tlačítko 'Stáhnout soubor' stáhnete kompletní formátovaný materiál ve formátu PDF.
Dalším užitečným signálem, který si vytvoříme jako MATLABovskou funkci bude
trojúhelníkový impuls, který nazveme TriangleImpuls.m a naprogramujeme ho opět jako
funkci. Bude
% function TriangleImpuls(t,a,b)
% t= time axis [sec]
% a= half width of impuls [sec]
% b= centre of impuls [sec]
function [ft] = TriangleImpuls(t,a,b);
P=max(t)-min(t);
if abs(b)>P/2
% limit of impuls center
b=sign(b)*P/2;
end;
ftp=(1/a)*(t+b+a);
ftp=ftp.*(StepFunction(t,a+b)-StepFunction(t,b));
ftn=(1/a)*(-t-b+a);
ftn=ftn.*(StepFunction(t,b)-StepFunction(t,-a+b));
ft=ftp+ftn;
return
Jeho volání opět naprogramujeme jako funkci
% function TriangleImpulsPlot(a,b,A)
-50
-40
-30
-20
-10
0
10
20
30
40
50
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Linear impuls
t [sec]
f(
t)
[
V
]
Signály a systémy
21
% a= half width of impuls [sec]
% b= centre of impuls [sec]
% A= amplitude of impuls [V]
function TriangleImpulsPlot(a,b,A)
P=100;
% time interval [sec]
N=512;
% number of samples [-]
t=linspace(-P/2,P/2,N); % discrete time axis
name=('Triangle impuls');
ft=A*TriangleImpuls(t,a,b);
plot(t,ft)
axis([-P/2 P/2 -0.2*A 1.2*A])
title([name,' a='num2str(a),' b=',num2str(b),' A=',num2str(A)]);
xlabel('t [sec]');
ylabel('f(t) [V]');
return
a po zavolání TriangleImpulsPlot(10,0,1) je výsledek na následujícím obrázku. Volejte funkci
s různými parametry a sledujte výsledný obrázek.
Ještě jeden signál, a to tlumený kosinusový signál si vytvoříme jako funkci
DampedCosineImpuls.m. Bude
% function DampedCosineImpuls(t,a,b,w0)
% t= time axis [sec]
% a= damping parameter [1/sec]
% b= centre of impuls [sec]
% w0= cosine frequency [rad/sec]
function [ft] = DampedCosineImpuls(t,a,b,w0);
P=max(t)-min(t);
if abs(b)>P/2
% limit of impuls centre
b=sign(b)*P/2;
-50
-40
-30
-20
-10
0
10
20
30
40
50
-0.2
0
0.2
0.4
0.6
0.8
1
Triangle impuls a=10 b=0 A=1
t [sec]
f(
t)
[
V
]
22
Fakulta elektrotechniky a komunikačních technologií VUT v Brně
end;
ft=cos(w0*(t+b)).*exp(-a*abs(t+b));
return;
Volání této funkce opět naprogramujeme jako funkci DampedCosineImpulsPlot.m
% function DumpedCosineImpulsPlot(a,b,w0,A);
% a= damping parameter [1/sec]
% b= centre of impuls [sec]
% w0= frequency of cosine [rad/sec]
% A= amplitude of impuls [V]
function DumpedCosineImpulsPlot(a,b,w0,A);
P=100;