How to observe changing responses over time in simulink

3 ビュー (過去 30 日間)
Tyler Mudge
Tyler Mudge 2020 年 12 月 12 日
移動済み: Sabin 2023 年 1 月 4 日
Hello, i am trying to observe the change of position of a system with respect to time. The mass of the system changes at t=20s by 15%, and I can show this in Matlab, but my plot is coming from a simulink model including a PID controller and a Transfer Function. I have also been able to vary the transfer function with respect to time, which, I think should change the response of the system with respect to time, so my question is, how do I observe this change of the response with respect to time from Simulink.
clc
clear
%% Define knowns
g = 9.81; % gravity [m/s^2]
k = 1.32435*10^-4; % Magnet force constant, [N/amp]
x_0 = 0.015; % steady state position [m]
for t = 1:1:50
if t <20
m(t)=0.06;
else
m(t)=0.06+(0.06*0.15);
end
end
i_0 = 1; % Steady state amps, assumed from NYU experiment [amp]
%% Define variable parameters
i = 1;
R = 10; % From NYU experiment [Ohm]
L = 0.4125; % Inductance from NYU experiment [Henry]
%% Checking Current System Stability
for t = 1:1:50
if t < 20
a(t) = (2*k*i_0)/(0.06*x_0^2); % num of TF
b(t) = (2*k*i_0^2)/(0.06*x_0^3); % part of den for TF
else
a(t) = (2*k*i_0)/(0.069*x_0^2); % num of TF
b(t) = (2*k*i_0^2)/(0.069*x_0^3); % part of den for TF
end
end
% a(t) = (2*k*i_0)/(m(t)*x_0^2); % num of TF
% b(t) = (2*k*i_0^2)/(m(t)*x_0^3); % part of den for TF
% num = [a];
% den = [1 0 b];
% sys = tf(num,den)
% % step(sys,t)
%% Simulate Model
maglev_sim = sim('Maglev_Model.slx');
%% Plotting m = 0.06 kg response
figure(1)
plot(maglev_sim.maglev,'LineWidth',2)
title('Position Response for m = 0.06kg')
ylabel('Position (m)')
xlabel('Time (s)')

回答 (1 件)

Mathieu NOE
Mathieu NOE 2020 年 12 月 13 日
移動済み: Sabin 2023 年 1 月 4 日
in your simulink file, you are using the standard transfer function bloc that works only with fixed coefficients
you have to change that to time varying bloc , as example :

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by