Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Data type error finding an actual value for the inverse Laplace of a function when attempting to plot it
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Navya Seelam
il 3 Dic 2019
Modificato: Navya Seelam
il 4 Dic 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 Commento
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!