Effacer les filtres
Effacer les filtres

how to find characteristics of a signal

2 vues (au cours des 30 derniers jours)
Ali Esmaeilpour
Ali Esmaeilpour le 1 Oct 2019
Hello guys! I got a code that gives a result "y" as output like a signal. I wanted to find it's characteristics l mean Rise time, Settling time, Overshoot and Peak absolute value of y(t). how can I find these characteristics with a code in a "m file"??? not with toolbox or any other matlab functions.
I don't need those characteristics for whole signal only from time (x axis) 5 till 9 is enough. I mean first I want to delete other parts and keep figure from time 5 till 9 and then find those characteristics with some codes not toolbox or matlab function.
my main code which produce "y" is as follows:
clc;
clear;
close all;
%% Initialization
T0=0 ;
Tf=20 ;
Ts=0.1 ;
t=T0:Ts:Tf ;
system=tf([1 1],[1 1 2]); % system=(s+1)/(s^2+s+2)
system_dis=c2d(system,Ts) ;
system_dis_ss=ss(system_dis) ;
Am=system_dis_ss.a;
Bm=system_dis_ss.b;
Cm=system_dis_ss.c;
n=size(Am,1); % Number of state variables
Om=zeros(1,n);
A=[Am,Om';Cm*Am,1];
B=[Bm ;Cm*Bm];
C=[Om 1];
p=10; % Prediction horizon
m=5; % Control horizon
Q=1;
R=1;
F=zeros(p,n+1);
for i=1:p
F(i,:)=C*A^i;
end
PHI=zeros(p,m);
for i=1:p
for j=1:i
PHI(i,j)=C*A^(i-j)*B;
end
end
PHI=PHI(:,1:m);
%% Main Loop
Nt=numel(t);
%W=ones(Nt,1); % Reference signal
W=[ones(floor(Nt/4),1);2*ones(floor(Nt/4),1);-ones(floor(Nt/4),1);zeros(floor(Nt/4+1),1)];
y=zeros(Nt,1);
du=zeros(Nt,1);
x=zeros(n+1,Nt); % (System state)+integral ===> n+1
Fval=zeros(Nt,1);
for i=1:Nt-1
FreeResponse=F*x(:,i);
dU=(PHI'*Q*PHI+R)\(PHI'*Q*(W(i)-FreeResponse))
du(i)=dU(1); % Receding horizon
x(:,i+1)=A*x(:,i)+B*du(i); % State variable update
y(i+1)=C*x(:,i+1); % Output update
end
%% Plot result
figure(1)
plot(t,y,'linewidth',2)
  2 commentaires
Ankit
Ankit le 1 Oct 2019
yes sure. for this you need following toolbox
  • Control System Toolbox
  • System Identification Toolbox
Ali Esmaeilpour
Ali Esmaeilpour le 1 Oct 2019
you mean I can't do this without toolbox???

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by