⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c6_nltvde.m

📁 简单举一个非线性的时变系统仿真的例子它以两个未分方程为基础
💻 M
字号:
% File: c6_nltvdr.m
w2b=0; w2c=0;      % initialize integrators
yd=0; y=0;         % initialize differential equation 
tfinal=50;         % simulation time
fs=100;            % sampling frequency
delt=1/fs;         % sanpling period
npts=1+fs*tfinal;  % number of samples simulaed
ydv=zeros(1,npts);% vector of dy/dt samples
yv=zeros(1,npts);  % vector of y(t) samples

% begining of simulation loop
for i=1:npts
    t=(i-1)*delt;                         % times
    if t<20                               
        ydd=4*exp(-t/2)-3*yd*abs(y)-9*y;  % de for t<20
    else 
        ydd=4*exp(-t/2)-3*yd-9*y;         % de for t>=20
    end    
    w1b=ydd+w2b;                          % first integrator- step 1
    w2b=ydd+w1b;                          % first integrator -step 2
    yd=w1b/(2*fs);                        % first integrator -output
    w1c=ydd+w2c;                          % second integrator -step 2
    w2c=ydd+w1c;                          % second  integrator -step 2
    y=w1c/(2*fs);                         % second  integrator -output
    ydv(1,i)=yd;                          % build dy/dt vector 
    yv(1,i)=y;                            % build y(t) vector
end
% end of simulation loop

plot(yv,ydv)                             % plot phase plane 
xlabel('y(t)')                           % label x axis 
ylabel('dy/dt')                          % label y zaxis
% End of script file.
     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -