Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
Michael Gibson
Michael Gibson 2019 年 11 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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)

回答 (1 件)

Navya Seelam
Navya Seelam 2019 年 12 月 3 日
編集済み: Navya Seelam 2019 年 12 月 4 日
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 2019 年 12 月 4 日
Thanks for answering, but I managed to get it figured out. Unfortunately, I don't remember what I did.

Community Treasure Hunt

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

Start Hunting!

Translated by