matlab simulink 气动伺服系统分析与控制

1、内容简介


583-可以交流、咨询、答疑

2、内容说明

3、仿真分析

close all
%%
sim("model2019a.mdl")
timePa = out.pa.Time;
pa = out.pa.Data;
timePb = out.pb.Time;
pb = out.pb.Data;
figure
plot(timePa,pa)
figure
plot(timePb,pb)


t = timePa;
A=0.000490625;
m = 0.51;
% Ff = 30;

a = zeros(1,length(timePa));

v = zeros(1,length(timePa));
v(1) = 0; % 速度初值

s = zeros(1,length(timePa));
s(1) = 150;   % 位移初值

sigma = 0.31;
ys_dot = 3.27;
Fs = 35.48;
Fc = 15.31;
Ff = zeros(1,length(timePa));
for i = 2:length(a)
%     Fp=A*(pa(i)-pb(i));
    part1 = sigma*v(i-1);
    part2 = sign(v(i-1));
    part3 = Fc+(Fs-Fc)*exp(-(v(i-1)/ys_dot)^2);
    Ff(i) = part1+part2*part3;
%     if abs(v(i-1))<=sigma
    a(i)=((A*(pa(i)-pb(i)))-Ff(i))/m;
    v(i)=v(i-1)+a(i)*(t(i)-t(i-1));
    s(i)=s(i-1)+v(i)*(t(i)-t(i-1));
        
    if s(i)<0 || s(i)>200
        if s(i)<0
            s(i)=0;
        else
            s(i)=200;
        end
        v(i)=0;
        a(i)=0;
    
    elseif s(i)==0
        v(i) = 0;
        s(i) = 0;
        if A*(pa(i)-pb(i))>=Ff
            a(i) = ((A*(pa(i)-pb(i)))-Ff)/m;
        else
            a(i) = 0;
        end
        
    elseif s(i)==200
        v(i) = 0;
        s(i) = 200;
        if A*(pa(i)-pb(i))<=-Ff
            a(i) = ((A*(pa(i)-pb(i)))+Ff)/m;
        else
            a(i) = 0;
        end
    end
end
%%
figure
plot(timePa,a)
xlabel time/s
ylabel 加速度
figure
plot(timePb,v)
xlabel time/s
ylabel 速度
figure
plot(timePb,s)
xlabel time/s
ylabel 位移

figure
plot(timePb,Ff)
xlabel time/s
ylabel 摩擦力

4、参考论文

《气动伺服系统分析与控制》--柏艳红[著]--2014.12.pdf

你可能感兴趣的:(Matlab系列案例,matlab,simulink,气动伺服系统分析与控制)