%Mr. Gamal Gamil Al_Kirshi
%
%Lab7_exa14
%
%<<Model Name: DC Motor>>
%
%This program will using to:
%1- make system's transfer function representation
%2- get impulse and step response of system.
%3- convert from open loop system to closed loop.
%4- finding system's root
clear all;close all;clc;
J=0.01; Kf=0.1; K=0.01; R=1; L=0.5;
%**************<<<<<<<<<<<>>>>>>>>>>>>>>************************
%%
%>>>>>>>>>>>>>>>system representation
num=[K];
a=[J Kf]; b=[L R];
den=[(J*L) ((J*R)+(L*Kf)) ((Kf*R)+K^2)];
sys_tf=tf(num,den)
%%
%>>>>>>>>>>>>>>>impulse response for system
impulse(sys_tf)
figure
impulse(num,den)
%%
%>>>>>>>>>>>>>>>step response for system
figure
step(sys_tf)
figure
step(num,den)
%%
%>>>>>>>>>>>>>>>convert open loop system to closed loop
[ncl,dcl]=cloop(num,den);
figure
step(ncl,dcl)
%%
%>>>>>>>>>>>>>>>finding system's root
figure
rlocus(num,den)
figure
rlocus(ncl,dcl)