Varying weight of a ball with time in a Maglev system
1 view (last 30 days)
Show older comments
Hello, I'm trying to vary the weight of a magnetically levitated ball with time. Namely, the balls weight is supposed to suddenly chand at time t=20s by 15%. Here is the code I have so far including the initial mass of the ball (0.06 kg):
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]
m_0 = 0.06; % initial ball's weight [kg]
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
a = (2*k*i_0)/(m_0*x_0^2); % num of TF
b = (2*k*i_0^2)/(m_0*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)')
%% Changing mass with time
The Simulink model is attached. So far I have been able to achieve the desired output of the ball's position being 0.015 m away with the original mass of 0.06 kg but now I need to change the mass with time and have the system still keep the ball at that position.
Any help is appreciated!
2 Comments
Gebretsadkan Fissha
on 10 Jul 2024
Hello, can you help me for solving sliding mode controller nonlinear odes of Maglev system?
Sam Chak
on 10 Jul 2024
Suggest you to post a new question (click on the ASK button) and show the nonlinear ODEs of the Maglev system.
Answers (1)
Kyle Rawding
on 17 Mar 2021
Hi -
It sounds like you're interested in updating your transfer function as the simulation runs to account for the changing mass, rather than defining static 'a' and 'b' constants.
I'd recommend taking a look at the accepted answer to this question:
Hope that helps!
-Kyle
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!