[問題] 請教那裏出了問題
第一個檔案
% file pend1a.m
%
function xdot = pend1a(t,x)
u = 0.1;
xdot(1) = x(3);
xdot(2) = x(4);
xdot(3) = -x(2) + 1*u;
xdot(4) = 21.6*x(2) - 2*u;
end
第二個檔案
% file simul1a.m
%
t0 = 0;
tf = 0.8;
x0 = [0;0;0;0];
[t,x] = ode45('pend1a',t0,tf,x0); % ode45 numerically solves
ord.diff.equations (ode)
subplot(2,1,1)
plot(t,x(:,1))
title('Inverted Pendulum Simulation 1a')
xlabel('t [s]'), ylabel('z(t) [m]'), grid
subplot(2,1,2)
plot(t,x(:,2))
xlabel('t [s]'), ylabel('theta(t) [rad]'), grid
已經有上網查過,好像是因為這是要調變的程式,無法直接執行。但還是不懂如何執行,
能請版友指導一下我這新手如何運行這個程式,感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.1.134