Using ss2tf when your matrices are variables without values yet

조회 수: 21 (최근 30일)
Wynand
Wynand 2024년 8월 10일
댓글: Sam Chak 2024년 8월 15일
syms m b k
A = [0 (1/m+1/b);-k (-k/m-k/b)]
B = [0;k]
C = [0 1]
D = [0]
[b,a] = ss2tf(A,B,C,D)
I would like to get the transfer function of those matrices but the ss2tf function requires the matrices to be numerical. Is there a way to get a symbolic answer or am I looking at the wrong function?
  댓글 수: 2
Walter Roberson
Walter Roberson 2024년 8월 11일
To be explicit:
ss2tf() does not work on symbolic variables. Very few of the functions in the Control System Toolbox will work with symbolic variables (the ones that do work are more or less by accident.)
Paul
Paul 2024년 8월 11일
편집: Paul 2024년 8월 11일
ss2tf is not listed on the Control System Toolbox Functions page nor (very surprisingly to me) on the Signal Processing Toolbox Functions page. It's been out of vogue from the CST for so long that I'm always a bit surprised when I see it brought up and wonder why users are asking about it. Not sure when it was taken of the SPT doc; maybe that's been more recent and the reason users still try to use it.
FWIW, tf2ss is still a documented function in the SPT, and it does happen to work with symbolic inputs.

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2024년 8월 10일
편집: Star Strider 2024년 8월 10일
I would not use the Symbolic Math Toolbox for this!
For undefined variables, use anonymous functions for them, and then pass the arguments to them later —
A = @(b,k,m) [0 (1/m+1/b);-k (-k/m-k/b)]
A = function_handle with value:
@(b,k,m)[0,(1/m+1/b);-k,(-k/m-k/b)]
B = @(k) [0;k]
B = function_handle with value:
@(k)[0;k]
C = [0 1]
C = 1x2
0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
D = [0]
D = 0
[n,d] = ss2tf(A(1,2,3),B(2),C,D)
n = 1x3
0 2 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
d = 1x3
1.0000 2.6667 2.6667
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
EDIT — (10 Aug 2024 at 13:55)
Also —
A = @(b,k,m) [0 (1/m+1/b);-k (-k/m-k/b)]
A = function_handle with value:
@(b,k,m)[0,(1/m+1/b);-k,(-k/m-k/b)]
B = @(k) [0;k]
B = function_handle with value:
@(k)[0;k]
C = [0 1]
C = 1x2
0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
D = [0]
D = 0
TFfcn = @(b,k,m) ss2tf(A(b,k,m),B(k),C,D);
b = 1;
k = 2;
m = 3;
[n,d] = TFfcn(b,k,m)
n = 1x3
0 2 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
d = 1x3
1.0000 2.6667 2.6667
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
.

추가 답변 (1개)

Paul
Paul 2024년 8월 10일
Hi Wynand,
For a low-order problem like this, you can use the Symbolic toolbox to evaluate the equtation that computes the transfer function from the state space matrices. If you try it without success, feel free to post back here showing the code you tried and what the problem is.
Also, assuming this model represents some sort of mass-spring-damper system, I suggest reviewing the derivation of the state space matrices, because the A and B matrices don't look correct. For example, 1/b does not have the same units as 1/m.
syms m b k
A = [0 (1/m+1/b);-k (-k/m-k/b)]
A = 
B = [0;k]
B = 
C = [0 1];
D = [0];
%[b,a] = ss2tf(A,B,C,D)
  댓글 수: 8
Wynand
Wynand 2024년 8월 15일
편집: Wynand 2024년 8월 15일
Good day @Sam Chak
I redid my work and go to this transfer function
syms k m b s
T = k/(m*s^2+b*s+k)
T = 
This seems to be inline with the equation you have as well. Thank you for you engagement
Sam Chak
Sam Chak 2024년 8월 15일
Please note that your transfer function does not include the gravity term 'mg'. Either you did not account for the effect of gravity, or you canceled out the effect of gravity in the force term , as follows:
which results in
.
If the latter is the case, then the transfer function is valid:
.
Your next step is to design a stabilizing equation such that the elevator reaches the target floor at the desired settling time without overshoot. Note that if you use the popular unconstrained Proportional–Derivative equation, the elevator will reach all target floors at the same settling time. For high-rise buildings, this assumption is somewhat unrealistic.
Additionally, please consider researching Otis Elevator, Kone Elevator, Toshiba Elevator, and Schindler's Lifts if possible.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by