From 8ac15bc5efafa2afc053c293152605b0e6ae60ff Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Tue, 3 Sep 2019 18:27:40 +0530 Subject: Xcos examples from textbooks and for blocks --- .../3432/CH7/EX7.34/DEPENDENCIES/acker_dk.sci | 73 ++++++++++++++ .../3432/CH7/EX7.34/DEPENDENCIES/fig_settings.sci | 9 ++ Working_Examples/3432/CH7/EX7.34/Ex7_34.sce | 110 +++++++++++++++++++++ Working_Examples/3432/CH7/EX7.34/Ex7_34_f0.pdf | Bin 0 -> 20224 bytes Working_Examples/3432/CH7/EX7.34/Ex7_34_f4.pdf | Bin 0 -> 23830 bytes Working_Examples/3432/CH7/EX7.34/Ex7_34_model.xcos | 1 + 6 files changed, 193 insertions(+) create mode 100755 Working_Examples/3432/CH7/EX7.34/DEPENDENCIES/acker_dk.sci create mode 100755 Working_Examples/3432/CH7/EX7.34/DEPENDENCIES/fig_settings.sci create mode 100755 Working_Examples/3432/CH7/EX7.34/Ex7_34.sce create mode 100755 Working_Examples/3432/CH7/EX7.34/Ex7_34_f0.pdf create mode 100755 Working_Examples/3432/CH7/EX7.34/Ex7_34_f4.pdf create mode 100755 Working_Examples/3432/CH7/EX7.34/Ex7_34_model.xcos (limited to 'Working_Examples/3432/CH7/EX7.34') diff --git a/Working_Examples/3432/CH7/EX7.34/DEPENDENCIES/acker_dk.sci b/Working_Examples/3432/CH7/EX7.34/DEPENDENCIES/acker_dk.sci new file mode 100755 index 0000000..3391d24 --- /dev/null +++ b/Working_Examples/3432/CH7/EX7.34/DEPENDENCIES/acker_dk.sci @@ -0,0 +1,73 @@ +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//A function written by Deepti Khimani. +//Usage:- +//[K, lambda]=acker_dk(a, b, pl) +//K=acker_dk(a, b, pl) +//a:- System matrix. +//b:- input matrix. +//p:- Desired poles. +//K:-State feedback gain for the control law u=-Kx. +//lambda:- Eigen values of (a-b*k) +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +function [K, lambda]=acker_dk(a, b, pl) + [lhs,rhs]=argn(0) + + if rhs == 0 then + disp(["K=acker_dk(a, b, pl)";"[K, lambda]=acker_dk(a, b, pl)"]); + disp(["a:- System matrix";"b:- input matrix";"p:- Desired poles"]); + disp(["K:-State feedback gain for the control law u=-Kx";... + "lambda:- Eigen values of (a-b*k)"]); + return; + end +[ra ca]=size(a); +[rb cb]=size(b); +l=length(pl); + +CO=cont_mat(a,b); + +if ra~=l then + error(["Dimension error:";"number of desired poles must equal... + to order of the system"]); +elseif ra~=ca then + error(["Dimension error:";"system matrix should be... + a sqaure matrix"]); +elseif rb~=ra then + error (["Dimension error:","Input matrix should have... + as many rows as a system matrix."]); +elseif rank(CO) \ No newline at end of file -- cgit