How would I visually represent my State Space Model?
이전 댓글 표시
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
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
2023년 11월 15일
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
2023년 11월 15일
Star Strider
2023년 11월 15일
My pleasure.
I believe your ‘A’ matrix may not be correct.
Kez
2023년 11월 15일
Star Strider
2023년 11월 15일
The first column and last row are all zeros. That just does not seem correct to me.
Kez
2023년 11월 15일
Star Strider
2023년 11월 15일
O.K. Since that works, go with it.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



