How would I visually represent my State Space Model?
Mostrar comentarios más antiguos
I have made a program to determine the state space model of a ball and beam system. I wanted to visualise the output as I believe a graph is more beneficial than a series of matricies. However, I do not know how.
I was thinking of shoowing the displacement along the beam across time
Below is my program , any advice would be appreciated.
clear;
close all;
clc;
%% Setting Base Parameters %%
m = 0.5; % Allows Input for Mass of Ball %
R = 0.02; % Allows Input for Radius of Ball %
d = 1; % Allows Input for Lever Arm offset of Ball %
g_acc = 9.8; % Sets Value of Gravitational acceleration %
L = 10; % Allows Input for Beam Length %
Mu = 0.35; % Allows Input for Co-efficient of Friction %
Fr = -(Mu*m*g_acc); % Calculates Friction of the Beam %
T = 10; % Allows viewing of system within a specific time frame %
%% Solid Ball System %%
%% Calculation for Solid Ball Transfer Function %%
R2 = R^2;
J = (2/5)*m*R2; % Calculates Moment of Inertia %
s = tf('s');
SB_TF = -(m*g_acc*d)/(L*(J/R2)+m*(s^2))
%% Graphing Transfer Function of Solid Ball %%
%% Linearised State Space Model of Solid Ball %%
H = - m*g_acc/(J/(R^2) + m); % Characteristic Equation %
A = [0 1 0 0;
0 0 H 0;
0 0 0 1;
0 0 0 0];
B = [0 0;
0 ((1/(J/(R^2) + m))*Fr);
0 0;
1 0];
C = [1 0 0 0];
D = 0*C*B;
SB_Fr = ss(A, B, C, D)
9 comentarios
First, be certain that it’s doing what you want it to do —
%% Setting Base Parameters %%
m = 0.5; % Allows Input for Mass of Ball %
R = 0.02; % Allows Input for Radius of Ball %
d = 1; % Allows Input for Lever Arm offset of Ball %
g_acc = 9.8; % Sets Value of Gravitational acceleration %
L = 10; % Allows Input for Beam Length %
Mu = 0.35; % Allows Input for Co-efficient of Friction %
Fr = -(Mu*m*g_acc); % Calculates Friction of the Beam %
T = 10; % Allows viewing of system within a specific time frame %
%% Solid Ball System %%
%% Calculation for Solid Ball Transfer Function %%
R2 = R^2;
J = (2/5)*m*R2; % Calculates Moment of Inertia %
s = tf('s');
SB_TF = -(m*g_acc*d)/(L*(J/R2)+m*(s^2))
%% Graphing Transfer Function of Solid Ball %%
%% Linearised State Space Model of Solid Ball %%
H = - m*g_acc/(J/(R^2) + m); % Characteristic Equation %
A = [0 1 0 0;
0 0 H 0;
0 0 0 1;
0 0 0 0];
B = [0 0;
0 ((1/(J/(R^2) + m))*Fr);
0 0;
1 0];
C = [1 0 0 0];
D = 0*C*B;
SB_Fr = ss(A, B, C, D)
figure
pzmap(SB_Fr)
grid
P = pole(SB_Fr)
figure
bodeplot(SB_Fr)
grid
figure
step(SB_Fr)
grid
figure
impulse(SB_Fr)
grid
.
Star Strider
el 15 de Nov. de 2023
The tf2ss function is from the Signal Propcessing Toolbox. Your function is created with the Control System Toolbox, and the two are not compatible, Just use the ss function to convert ‘SB_TF’ to state space representation.
Kez
el 15 de Nov. de 2023
Star Strider
el 15 de Nov. de 2023
My pleasure.
I believe your ‘A’ matrix may not be correct.
Kez
el 15 de Nov. de 2023
Star Strider
el 15 de Nov. de 2023
The first column and last row are all zeros. That just does not seem correct to me.
Kez
el 15 de Nov. de 2023
Star Strider
el 15 de Nov. de 2023
O.K. Since that works, go with it.
Respuestas (0)
Categorías
Más información sobre Assumptions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



