Converting Symbolic State Space to Transfer Function
조회 수: 23 (최근 30일)
이전 댓글 표시
Hey guys,
So I've been trying for ages to solve this problem...
syms chord S aw mtdot xf e EI v rho ac bc GJ m A B C D;
%%Wing Parameters %%
chord = 2;
S = 7.5;
aw = 2*pi;
EI = 2e7;
GJ = 2e6;
E = [(4*EI)/((S^3)) 0; 0 GJ/5];
EC = 0.2
bc = -(aw/pi)*(1-EC)*sqrt(EC*(1-EC));
ac = (aw/pi)*((acos(1-(2*EC)))+(2*sqrt(EC*(1-EC))));
xf = 0.48*chord;
e = 0.8;
m = 100;
mtdot = -1.2;
rho = 1.225;
v
%%Parameters Contained In Matrices %%
a = [(m*S*chord/5) (m*(S/4)*((chord^2)/2 - chord*xf)); ...
m*(S/4)*((chord^2)/2 - chord*xf) m*((S/3)*((chord^3)/3 ...
- (chord^2)*xf + (chord*xf)^2))];
b = [(chord*S*aw)/10 0;-((chord^2)*S*aw*e)/8 -((chord^3)*S*mtdot)/24];
c = [0 ((chord*S*aw)/8);0 -((chord^2)*e*S*aw)/6];
I = eye(2);
g = (rho*v^2)*[-(S*ac*chord)/6; ((chord^2)*bc*S)/4];
%%Define State Space System %%
A = [zeros(2) I;(-a^-1)*(rho*(v^2)*c + E) (-a^-1)*(rho*v*b)];
B = [[0;0];(a^-1)*g];
C = [1 -xf 0 0];
D = 0;
%%Create Transfer Function %%
[n,d]=ss2tf(A,B,C,D)
mySys_tf=tf(n,d)
However this error message is displayed:
Error using ss2tf (line 26)
The following error occurred converting from sym to double:
DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use VPA.
Error in Flutter_Model (line 39)
[n,d]=ss2tf(A,B,C,D)
How can I go about fixing this? Your help would be greatly appreciated!
댓글 수: 0
답변 (2개)
Star Strider
2018년 10월 11일
Your ‘A’ matrix and ‘B’ vector contain symbolic variable ‘v’:
A =
[ 0, 0, 1.0, 0]
[ 0, 0, 0, 1.0]
[ -632.85, 31.872 - 0.050616*v^2, -0.04037*v, 0.00029282*v]
[ 15.11, 0.050213*v^2 - 637.43, 0.037717*v, -0.0058564*v]
B =
0
0
-0.034839*v^2
-0.0085273*v^2
You can either define them with a value for ‘v’ in your symbolic code, or create an anonymous function from each of them (the easiest way is to use the matlabFunction (link) function), pass the appropriate value of ‘v’ to the functions, and then use the evaluated matrices (then with only double values) in ss2tf.
댓글 수: 0
Walter Roberson
2018년 10월 11일
If you are deliberately trying to create a transfer function with a parameter in it, then see https://www.mathworks.com/matlabcentral/answers/305339-how-to-create-a-transfer-function-with-gain-k#answer_236890 for the discussion of what is possible in MATLAB.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!