Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

QUESTION 1:

CODE:
clear all
clc
Vr=input ('enter a intial value')
%from the input values
h1=tf([10],[0.1 1]);
h2=tf([1],[0.05 1]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1.*Vr;
%from the function,
V2=tf([1],[0.4 1]).*Ve;
Pl= input('enter value of change in load');
Vt=tf([1],[1 1]).*(V2+Pl);
%t is the transfer function
t=feedback (Vt,Vr);
bode (t);
grid on

results:
enter a intial value
1

Vr =

enter value of change in load


1
t

t =

0.002 s^3 + 0.065 s^2 + 0.95 s + 10


---------------------------------------------
0.002 s^4 + 0.069 s^3 + 0.68 s^2 + 2.5 s + 11

Continuous-time transfer function.


Question 2:
clear all
clc
Vr=input ('enter a intial value')
%from the input values
h1=tf([10],[.1 1]);
h2=tf([1],[.05 1]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1.*Vr;
%from the function,
V2=tf([1],[0.4 1]).*Ve;
Pl= input('enter value of change in load');
Vt=tf([1],[1 1]).*(V2+Pl);
%t is the transfer function
t=feedback (Vt,Vr);
bode (t);
grid on
rlocus (t);

output:
Vr =

enter value of change in load


1
Question 3:
clear all
clc
Vr=input ('enter a intial value')
%from the input values
h1=tf([10],[1 0.1]);
h2=tf([1],[1 0.05]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1.*Vr;
%from the function,
V2=tf([1],[1 0.4]).*Ve;
Pl= input('enter value of change in load');
Vt=tf([1],[1 1]).*(V2+Pl);
%t is the transfer function
t=Vt/Vr;
bode (t);
grid on
rlocus (t);
step (t);

output:
In simulink:

With pid:
Question 4:
Code:
clear all
clc
Vr=input ('enter a intial value')
%from the input values
h1=tf([10],[0.1 1]);
h2=tf([1],[0.05 1]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1.*Vr;
%from the function,
V2=tf([1],[0.4 1]).*Ve;
Pl= input('enter value of change in load');
Vt=tf([1],[1 1]).*(V2+Pl);
%t is the transfer function
t=feedback (Vt,Vr)
bode (t);
grid on
rlocus (t);
step (t);
output:
enter a intial value
1

Vr =

enter value of change in load


1

t =

0.002 s^3 + 0.065 s^2 + 0.95 s + 10


---------------------------------------------
0.002 s^4 + 0.069 s^3 + 0.68 s^2 + 2.5 s + 11

Continuous-time transfer function.


Question 5:
clear all
clc
Vr=input ('enter an intial value');
%from the input values
h1=tf([10],[.1 1]);
h2=tf([1],[0.05 1]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1;
%from the function,
V2=tf([1],[0.4 1]).*Ve;
Pl=input ('enter a value for load distrubance')
Vt=tf([1],[1 1]).*(V2+Pl);
kp=dcgain (Vt);
sse=1/(1+kp); %steady state error
t=feedback (Vt,Vr);
step (t);

output:
enter an intial value
1
enter a value for load distrubance
1

Pl =

sse

sse =

0.0909
question 6:
Code:
clear all
clc
Vr=input ('enter an intial value');
%from the input values
h1=tf([10],[.1 1]);
h2=tf([1],[0.05 1]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1;
%from the function,
V2=tf([1],[0.4 1]).*Ve;
Pl=input ('enter a value for load distrubance')
Vt=tf([1],[1 1]).*(V2+Pl);
kp=dcgain (Vt);
sse=1/(1+kp); %steady state error
t=feedback (Vt,Vr);
bode (t);

output:
enter an intial value
1
enter a value for load distrubance
1

Pl =

1
question 7
Code:
clear all
clc
Vr=input ('enter the intial value');
%from the input values
h1=tf([10],[0.1 1]);
h2=tf([1],[0.05 1]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1;
%from the function,
V2=tf([1],[0.4 1]).*Ve;
Pl=input ('enter a value for load distrubance')
Vt=tf([1],[1 1]).*(V2+Pl);
%t is the transfer function
t=feedback (Vt,Vr);
step (t);

xc = pid(.25,.0001,0.00009);
tc=t.*xc;
step (tc);
kp=dcgain (tc);
sse=1/(1+kp); %steady state error

output:
enter the intial value
1
enter a value for load distrubance
1

Pl =

sse
sse =0
In Simulink:
Output:

Using pid:
Question 8:
Code:
clear all
clc
Vr=input ('enter the intial value');
%from the input values
h1=tf([10],[0.1 1]);
h2=tf([1],[0.05 1]);
%as h2 is subtracting.so,
V1=h1-h2;
%V1=Ve/Vr
Ve=V1;
%from the function,
V2=tf([1],[0.4 1]).*Ve;
Pl=input ('enter a value for load distrubance')
Vt=tf([1],[1 1]).*(V2+Pl);
%t is the transfer function
t=feedback (Vt,Vr);
step (t);
hold on
xc = pid(.25,.0001,0.00009);
tc=t.*xc;
step (tc);
kp=dcgain (tc);
sse=1/(1+kp); %steady state error
output:
enter the intial value
1
enter a value for load distrubance
1

Pl =

You might also like