MATLAB Answers

Data type error finding an actual value for the inverse Laplace of a function when attempting to plot it

조회 수: 3(최근 30일)
Michael Gibson
Michael Gibson 28 Nov 2019
댓글: Michael Gibson 4 Dec 2019
So I have a function that I'm running through inverse Laplace and then trying to get an actual number out of so I can plot it, but I keep getting data type errors and I don't know why. Here is my code: Help?
I6 = 3;
L = 0.5;
I3 = 1.2 * I6;
C8 = -9.81;
I9 = (I6*L^2)/12;
H = L^2*(I3*I9+I6*I9)-4*I3*I6;
syms s t
f_n = 1000;
k = I3*(2*pi()*f_n)^2;
C2 = 1/k;
X = det([0 -1/I3 0 0; ...
(H-L^2*I9)/(H) s (2*L^2*I3*I6)/(H*C8) 0; ...
0 0 s -1/I9; ...
-(2*L*I9)/H 0 -(2*L*I3*I6+H)/(H*C8) s]);
Theta = det([s -1/I3 0 0; ...
(L^2*I6*I9)/(H*C2) s (H-L^2*I9)/H 0; ...
0 0 0 -1/I9; ...
-(2*L*I6*I9)/(H*C2) 0 -(2*L*I9)/H s]);
F_in = det([s -1/I3 0 0; ...
(L^2*I6*I9)/(H*C2) s (2*L^2*I3*I6)/(H*C8) 0; ...
0 0 s -1/I9; ...
-(2*L*I6*I9)/(H*C2) 0 -(2*L*I3*I6+H)/(H*C8) s]);
ANS1 = X/F_in;
ANS2 = Theta/F_in;
X_out = ilaplace(ANS1/s);
Theta_out = ilaplace(ANS2/s);
t0 = [0:1:10];
X_o=zeros(length(t0),1);Theta_o=zeros(length(t0),1);
for z=1:length(t0)
subs(ilaplace(ANS1/s),t,t0(z));
X_o(z) = double(ans);
subs(ilaplace(ANS2/s),t,t0(z));
Theta_o(z) = double(ans);
end
plot(t,X_o)
plot(t,Theta_o)

  댓글 수: 0

로그인 to comment.

답변(1개)

Navya Seelam
Navya Seelam 3 Dec 2019
편집: Navya Seelam 4 Dec 2019
Hi,
t is a variable and hence cannot be used with plot function. You can plot X_o against t0.
plot(t0,X_o)

  댓글 수: 1

Michael Gibson
Michael Gibson 4 Dec 2019
Thanks for answering, but I managed to get it figured out. Unfortunately, I don't remember what I did.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by