سیستم های کنترل خطی - صفحه(1)
سیستم های کنترل خطی
1)Transfer Function(تابع تبدیل)
.
مثال اول:
%G=5(s^3+5s+6)/s^7+2s^5+5s^3+7s^2+2
clc;clear;close all
num=[5 0 25 30];
den=[1 0 2 0 5 7 0 2];
G=tf(num,den)
.
.
مثال دوم:
clc;clear;close all
%G=2(s^10+s^5+2s+7)/s^11+12s^3+6s^2+5s^4+10
num=[2 0 0 0 0 2 0 0 0 2 7];
den=[1 0 0 0 0 0 0 5 12 6 0 10];
G=tf(num,den)
.
.
سری کردن چند تابع تبدیل
.
clc;clear;close all
num1=[5];
den1=[1 0];
G1=tf(num1,den1)
num2=[6 12];
den2=conv([1 1],[1 5]);
G2=tf(num2,den2)
num3=[1 1];
den3=[1 0 2];
G3=tf(num3,den3)
G12=series(G1,G2);
GF=series(G12,G3)
.
موازی کردن چند تابع تبدیل
.
clc;clear;close all
num1=[5];
den1=[1 0];
G1=tf(num1,den1)
num2=[6 12];
den2=conv([1 1],[1 5]);
G2=tf(num2,den2)
num3=[1 1];
den3=[1 0 2];
G3=tf(num3,den3)
G12=parallel(G1,G2);
GF=parallel(G12,G3)
.
سری-موازی کردن چند تابع تبدیل
.
clc;clear;close all
num1=[5];
den1=[1 0];
G1=tf(num1,den1)
num2=[6 12];
den2=conv([1 1],[1 5]);
G2=tf(num2,den2)
num3=[1 1];
den3=[1 0 2];
G3=tf(num3,den3)
G12=parallel(G2,G3);
GF=series(G1,G12)
.
فیدبک
.
clc;clear;close all
num1=[5];
den1=[1 0];
G1=tf(num1,den1)
num2=[6 12];
den2=conv([1 1],[1 5]);
G2=tf(num2,den2)
num3=[1 1];
den3=[1 0 2];
G3=tf(num3,den3)
G12=feedback(G1,G2);
GF=parallel(G12,G3)
.
اثر ورودی در تابع تبدیل
.
(ورودی ضربه)
.
%Determination of shock response
clc;clear;close all
num=[10 5];
den=[1 20 50];
GF=tf(num,den);
t0=0 ; tfinal=2; n=100;
T=linspace(t0,tfinal,n);
[y,t]=impulse(GF,T);
plot(t,y,'r')
title('Impulse Resonse');
xlabel('Time (seconds)')
ylabel('Amplitude')
grid on
.
(ورودی پله)
.
%Determination of step response
clc;clear;close all
num=[10 5];
den=[1 20 50];
GF=tf(num,den);
t0=0 ; tfinal=2; n=100;
T=linspace(t0,tfinal,n);
[y,t]=step(GF,T);
plot(t,y,'b')
title('Step Resonse');
xlabel('Time (seconds)')
ylabel('Amplitude')
grid on
.
(ورودی شیب)
.
%Determination of Ramp response
clc;clear;close all
num=[10 5];
den=[1 20 50];
GF=tf(num,den);
t0=0 ; tfinal=2; n=100;
T=linspace(t0,tfinal,n);
u=T;
[y,t]=lsim(GF,u,T);
plot(t,y,'k')
title('Ramp Resonse');
xlabel('Time (seconds)')
ylabel('Amplitude')
grid on
.
(RC اثر ورودی های مختلف در مدار سری)
.
%Determination of Series RC Circuit shock-Step-Ramp-Parabolic response
clc;clear;close all
R=10e3;
C=20e-9;
num=[1];
den=[(R*C) 1];
GF=tf(num,den);
t0=0 ; tfinal=2e-3; n=100;
T=linspace(t0,tfinal,n);
u1=T;%Ramp
u2=T.^2;%Parabolic
[y1,t1]=impulse(GF,T);
[y2,t2]=step(GF,T);
[y3,t3]=lsim(GF,u1,T);
[y4,t4]=lsim(GF,u2,T);
subplot(2,2,1)
plot(t1,y1,'r')
title('Impulse Resonse');
xlabel('Time (seconds)')
ylabel('Amplitude')
grid on
subplot(2,2,2)
plot(t2,y2,'b')
title('Step Resonse');
xlabel('Time (seconds)')
ylabel('Amplitude')
grid on
subplot(2,2,3)
plot(t3,y3,'k')
title('Ramp Resonse');
xlabel('Time (seconds)')
ylabel('Amplitude')
grid on
subplot(2,2,4)
plot(t4,y4,'g')
title('Parabolic Resonse');
xlabel('Time (seconds)')
ylabel('Amplitude')
grid on
.
.
.


