From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 3432/CH3/EX3.4/Ex3_4.sce | 65 ++++++++++++++++++++++++++++++++++++++++++++ 3432/CH3/EX3.4/Ex3_4_f0.pdf | Bin 0 -> 23237 bytes 3432/CH3/EX3.4/Ex3_4_f1.pdf | Bin 0 -> 20300 bytes 3 files changed, 65 insertions(+) create mode 100644 3432/CH3/EX3.4/Ex3_4.sce create mode 100644 3432/CH3/EX3.4/Ex3_4_f0.pdf create mode 100644 3432/CH3/EX3.4/Ex3_4_f1.pdf (limited to '3432/CH3/EX3.4') diff --git a/3432/CH3/EX3.4/Ex3_4.sce b/3432/CH3/EX3.4/Ex3_4.sce new file mode 100644 index 000000000..dacf05a5f --- /dev/null +++ b/3432/CH3/EX3.4/Ex3_4.sce @@ -0,0 +1,65 @@ +//Example 3.4 +//Frequency response + +xdel(winsid())//close all graphics Windows +clear; +clc; +//------------------------------------------------------------------ +//(a) Frequency response of 1/(s+k) +k=1; +fmin=1e-2; +fmax=1e2; +// Transfer function +s=poly(0,'s'); +sysH=syslin('c',1/(s+k)) + +//Frequency response for k=1 +//Note that - magnitude plot semilog plot unlike log-log plot in the book. +bode(sysH,fmin,fmax) +title('Frequency response for k=1','fontsize',3) + +//------------------------------------------------------------------ +//(b) Response to u=sin(10*t); +t=0:0.02:10; +u=sin(10*t); +y=csim(u,t,sysH); +figure, plot(t,y) + +//Title, labels and grid to the figure +exec .\fig_settings.sci; // custom script for setting figure properties +title('Complete transient response','fontsize',3) +xlabel('Time (sec.)','fontsize',2) +ylabel('Output','fontsize',2) + +//phase lag +figure, plot(t,y) +plot(t,u,'r') +zoom_rect([9 -1 10 1]) +exec .\fig_settings.sci; // custom script for setting figure properties +title('Phase lag between output and input','fontsize',3) +xlabel('Time (sec.)','fontsize',2) +ylabel('Output, Input','fontsize',2) +h=legend('y(t)','u(t)') +h.legend_location = "in_upper_right" +h.fill_mode='off' + +// time lag +w=find(t>=9.4 & t<=10); +T=t(w); +Y=y(w); +U=u(w); +wu=find(U==max(U)) +wy=find(Y==max(Y)) + +//Responses +plot2d3(T(wy),Y(wy)) +plot2d3(T(wu),U(wu)) +delta_t=T(wu)-T(wy); //time lag sec. +xstring(9.64,-0.1,"$\delta t$",0,0) +xarrows([9.58;9.72], [0;0], 0.7, 1) +xarrows([9.72;9.58], [0;0], 0.7, 1) +t=get("hdl") +disp(abs(delta_t), "Time lag of output in sec. is") +disp(abs(delta_t)*10, "Phase lag of output in radians is") + +//------------------------------------------------------------------ diff --git a/3432/CH3/EX3.4/Ex3_4_f0.pdf b/3432/CH3/EX3.4/Ex3_4_f0.pdf new file mode 100644 index 000000000..8910b81c6 Binary files /dev/null and b/3432/CH3/EX3.4/Ex3_4_f0.pdf differ diff --git a/3432/CH3/EX3.4/Ex3_4_f1.pdf b/3432/CH3/EX3.4/Ex3_4_f1.pdf new file mode 100644 index 000000000..1a5b20a54 Binary files /dev/null and b/3432/CH3/EX3.4/Ex3_4_f1.pdf differ -- cgit