(Solve LTI systems using Z - Transform and how to generate this algorithm in Delphi language)
Mari kita mencoba menyelesaikan LTI sistem dengan transformasi-z, kemudian membuat algoritmanya dengan bahasa Delphi.
Cara menyelesaikan sistem LTI dangan transformasi-Z
Dibawah ini adalah kode script yang saya buat dengan menggunakan bahasa Delphi :
procedure TForm1.BitBtn_generateClick(Sender: TObject);
var
frek_respon :array[0..100] of real;
frek_respon_db:array[0..100] of real;
phase_respon :array[0..100] of real;
frequence :array[0..100] of real;
freq_sampling :real;
angel :real;
rad :real;
rad_limit :real;
i :integer;
begin
//clear the chart
chart1.Series[0].Clear;
chart1.Series[1].Clear;
chart2.Series[0].Clear;
chart3.Series[0].Clear;
chart3.Series[0].Clear;
//generate the magnitude frequency respons
rad_limit:=strtofloat(edit_rad_limit.Text);
rad:=0;
i:=0;
repeat
frek_respon[i]:=1/(sqrt(sqr(1+0.5*cos(pi*rad)+0.2*cos(2*pi*rad))+sqr(-0.5*sin(pi*rad)-0.2*sin(2*pi*rad))));
chart1.Series[0].AddXY(i,frek_respon[i],'');
chart1.Series[1].AddXY(i,frek_respon[i],'');
i:=i+1;
rad:=rad+0.25;
until rad>rad_limit;
//generate the magnitude frequency respons in Decibels
rad:=0;
i:=0;
repeat
frek_respon_db[i]:=20*math.LogN(10,frek_respon[i]);
chart3.Series[0].AddXY(i,frek_respon_db[i],'',clblue);
i:=i+1;
rad:=rad+0.25;
until rad>rad_limit;
//generate phase respons
rad:=0;
i:=0;
repeat
angel:=arctan((-0.5*sin(rad))-(0.2*sin(2*rad))/(1+0.5*cos(rad)+0.2*cos(2*rad)));
phase_respon[i]:=radtodeg(angel);
chart4.Series[0].AddXY(i,phase_respon[i],'',clyellow);
i:=i+1;
rad:=rad+0.25;
until rad>rad_limit;
//generate frequence
rad:=0;
i:=0;
freq_sampling:=strtofloat(edit_freq_sampling.Text);
repeat
frequence[i]:=(rad/2)*freq_sampling;
chart2.Series[0].AddXY(i,frequence[i],'',clgreen);
i:=i+1;
rad:=rad+0.25;
until rad>rad_limit;
end;
Demikian, kritik dan saran sangat saya harapkan
This is the Author Bio Box
Enter short description about yourself here
Get more from ahmad aris syaefuddin on Google+ and Twitter
0 komentar: