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
|
|
| newton.m |
%NEWTON finds the real zeros of the function y.
% NEWTON finds real zeros by an interactive Newton procedure.
% Uses the M-file ITERMENU.
tol = 0.00001;
disp('Enter the equation to be solved, y(x), and the derivative')
disp('of y with respect to x as strings variables, for example:')
disp('y = ''x - sin(x) - c''')
disp('dydx = ''1 - cos(x)''')
disp('When the program returns the prompt k enter the appropriate')
disp('escape command to exit keyboard mode and continue the program.')
keyboard
disp('Enter now the range within which you want to plot the equation.')
disp('Then, after viewing the plot press any key to continue')
xmin = input('x min = ')
xmax = input('x max = ')
xx = xmin: (xmax-xmin)/100: xmax;
z = zeros(1, 100);
for k = 1:101
x = xx(k);
yy = eval(y);
z(k) = yy;
end
plot(xx, z)
grid
title('Plot of the equation to be solved')
xlabel('x')
ylabel('y(x)')
pause
real_zeros = [ ]; % initialize array of real zeros
itermenu
answer = input('Enter your choice')
while answer ~= 3
if answer == 1
xmin = input('x min = ')
xmax = input('x max = ')
xstep = (xmax - xmin)/100;
xx = xmin: xstep: xmax;
z = zeros(1, 100);
for k = 1: 101
x = xx(k);
yy = eval(y);
z(k) = yy;
end
plot(xx, z)
grid
xlabel('x')
ylabel('y')
pause
itermenu
answer = input('Enter your choice')
elseif answer == 2
disp('Enter initial guess')
[ x, yg ] = ginput(1)
for l = 1:100
x0 = x;
x = x0 - eval(y)/eval(dydx)
if abs(x - x0) < tol
break
end
end
if (l == 100)&(abs(x - x0) >= tol)
disp('Procedure did not converge')
else
real_zeros = [ real_zeros x ];
end
itermenu
answer = input('Enter new choice')
else
if answer ~= 3
disp('Incorrect answer, please repeat')
itermenu
answer = input('Enter new choice')
end
end
end
|
|
Contact us at files@mathworks.com