No BSD License
-
Zi =filteric(B,A,X,Y)
-
acosd(alpha)
ACOSD arc cos, in degrees, of the elements of alpha.
-
ayrton(range, amp, resist)
AYRTON calculates resistances for an Ayrton multirange ammeter.
-
bending1(s, d, F1, F2)
BENDING1 bending moments caused vehicle moving on beam.
-
conic(phi, param)
CONIC.M generates a conic section whose equation is given in polar form.
-
dcmot(t,om);
this function represents the model of a DC motor
-
dervabk(t,x);
this function returns the derivatives of the unit feedback system
-
divide(x, y)
-
eulangle(psi, theta, phi)
EULANGLE matrix of rotations by Euler's angles.
-
evalpol2(c, x)
EVALPOL2 Polynomial evaluation by Horner's scheme.
-
fact(x)
FACT factorial by a recursive procedure.
-
gcd1(x, y, tol)
-
gcd2(x, y)
GCD2 greatest common divisor by a recursive procedure.
-
pend(t,w);
This m-file describes the motion of a pendulum subject to gravity,
-
pliny(t,h);
This function respresents the model of the Pliny's intermittent fountain
-
rndprm1(X);
RNDPRM1 random permutation of row vector using FOR loop.
-
rndprm2(X);
RNDPRM2 random permutation of row vector using WHILE loop.
-
rndprm3(X);
RNDPRM3 random permutation of row vector using recursion.
-
rtate(theta)
RTATE(THETA) rotates theta degrees counterclockwise
-
scale(alpha, beta)
SCALE scaling matrix.
-
segment(A,r)
SEGMENT angle subtended by a circular segment.
-
segment1(A,r)
SEGMENT1 angle of circular segment, plot of iterations.
-
simp(x, y)
SIMP(X, Y) Simpson integration of tabular data y(x).
-
sind(alpha)
-
sind(alpha)
COSD(ALPHA) cosine of the elements of ALPHA, angle measured in degrees.
-
spipe(Re)
LAMBDA smooth-pipe frictional coefficient.
-
tankv(M, V0, tol)
TANKV(M, V0, tol) tank volume by iterative method
-
trlate(dx, dy)
-
uramp(t, t0)
URAMP(t, t0) unit ramp function beginning at t0.
-
ustep(t, t0)
-
vprod(A, B)
-
wd =doga(t,w);
This function represents the model of the dog chasing problem,
-
wd =dogb(t,w);
This function represents the model of the dog chasing problem,
-
wd=derv2a(t,w);
example of linear differential equation
-
wd=derv2b(t,w);
example of linear differential equation
-
wd=derv3a(t,w);
example of linear differential equation
-
wd=derv3b(t,w);
example of linear differential equation
-
wd=invp(t,w);
inverted pendulum on a cart.
-
wd=spring(t,w);
This function defines the differential equation relative to
-
wd=stiff(t,w);
This function defines the differential equation of a stiff system
-
xd=cspring(t,x);
This function defines the spring system. It is written in the format
-
alias.m
-
atmpres.m
-
bolind1.m
-
br1.m
-
br2.m
-
br3.m
-
ch14ex10.m
-
ch14ex12.m
-
ch14ex2a.m
-
ch14ex2b.m
-
ch14ex3a.m
-
ch14ex3b.m
-
ch14ex4a.m
-
ch14ex4b.m
-
ch14ex7.m
-
ch15ex11.m
-
ch15ex14.m
-
ch15ex16.m
-
ch15ex3.m
-
ch15ex5.m
-
ch15ex7.m
-
ch15ex8.m
-
ch15ex9.m
-
ch16ex10.m
-
ch16ex12.m
-
ch16ex2.m
-
ch16ex3.m
-
ch16ex7.m
-
complext.m
-
crane.m
-
diode.m
-
door.m
-
evalpol.m
-
evalpol1.m
-
exa2_05.m
-
exa3_05.m
-
exa3_06.m
-
exam04_1.m
-
exam09_2.m
-
exam09_3.m
-
exe10_02.m
-
exe10_06.m
-
exe10_09.m
-
exe11_12.m
-
exe11_13.m
-
exe17_04.m
-
exer2_03.m
-
exer2_04.m
-
exer2_06.m
-
exer2_09.m
-
exer2_11.m
-
exer3_03.m
-
exer3_07.m
-
exer3_10.m
-
exer3_13.m
-
exer3_14.m
-
exer4_05.m
-
exer4_06.m
-
exer4_10.m
-
exer5_07.m
-
exer6_05.m
-
exer6_06.m
-
exer6_08.m
-
exer7_03.m
-
exer8_02.m
-
exer8_05.m
-
exer9_05.m
-
exer9_11.m
-
fig04_06.m
-
fig04_09.m
-
fig05_08.m
-
fig06_01.m
-
fig06_02.m
-
fig10_03.m
-
fig10_04.m
-
fig10_12.m
-
fig11_01.m
-
fig11_02.m
-
fig1_11.m
-
fndwmal.m
-
hello.m
-
hi_lo.m
-
itermenu.m
-
kvisc.m
-
newton.m
-
ospring.m
-
pipe.m
-
raphson.m
-
rectify.m
-
rod1.m
-
rod2.m
-
s_couple.m
-
scissor.m
-
supsteam.m
-
turbot.m
-
ultim.m
-
vecrot.m
-
yellow.m
-
yellow1.m
-
View all files
|
|
| wd=invp(t,w); |
function wd=invp(t,w);
% inverted pendulum on a cart.
% This function simulates the dynamics of an inverted pendulum on cart.
% The states are:
% w(1) position of the trolley, x
% w(2) its derivative, x_dot
% w(3) angle of the pendulum from the vertical th
% w(4) its derivative th_dot
% The array K determines the external force u=-K*w applied to the cart
% and must be defined and declared global in the calling function
% The physical laws that define the system are:
%
% (M+m) x_dd + ml cos(th) th_dd = ml sin(th) (th_d)^2 + F
% ml cos(th) x_dd + m l^2 th_dd = mgl sin(th)
% --- define parameters of the system
g = 9.81; % gravity acceleration, m/s^2
l = 0.5; % length of the pendulum, m
M = 1.0; % mass of the cart, Kg
m = 0.1; % mass of the pendulum
% --- compute external force
% if you are using a version of MATLAB prior to 4.0
% please delete next line
global K;
F =-K*w;
% --- compute second derivatives x_dd and th_dd
x = w(1);
x_d = w(2);
th = w(3);
th_d = w(4);
G = [(M+m) m*l*cos(th);
m*l*cos(th) m*(l^2) ];
H = [m*l*(sin(th))*(th_d)^2 + F ;
m*g*l*sin(th) ];
Drv = G\H; % [x_dd; th_dd]
[m,n] = size(w); wd=zeros(m,n);
wd(1) = w(2);
wd(2) = Drv(1);
wd(3) = w(4);
wd(4) = Drv(2);
|
|
Contact us at files@mathworks.com