How to observe changing responses over time in simulink
조회 수: 3 (최근 30일)
이전 댓글 표시
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)')
댓글 수: 0
답변 (1개)
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 :
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!