Professional Documents
Culture Documents
Code:: All 'Enter A Intial Value'
Code:: All 'Enter A Intial Value'
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 =
t =
output:
Vr =
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 =
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 =