Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
153 views

MATLAB Programming for Engineers 5th Edition Chapman Solutions Manualinstant download

The document provides information about various MATLAB programming solution manuals, including links for downloading them. It includes code examples for generating random numbers and calculating hyperbolic functions using MATLAB. Additionally, it discusses the structure of functions and their accessibility within MATLAB programming.

Uploaded by

cusbanuor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
153 views

MATLAB Programming for Engineers 5th Edition Chapman Solutions Manualinstant download

The document provides information about various MATLAB programming solution manuals, including links for downloading them. It includes code examples for generating random numbers and calculating hyperbolic functions using MATLAB. Additionally, it discusses the structure of functions and their accessibility within MATLAB programming.

Uploaded by

cusbanuor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

MATLAB Programming for Engineers 5th Edition

Chapman Solutions Manual pdf download

https://testbankfan.com/product/matlab-programming-for-
engineers-5th-edition-chapman-solutions-manual/
We believe these products will be a great fit for you. Click
the link to download now, or visit testbankfan.com
to discover even more!

MATLAB Programming with Applications for Engineers 1st


Edition Chapman Solutions Manual

https://testbankfan.com/product/matlab-programming-with-
applications-for-engineers-1st-edition-chapman-solutions-manual/

Essentials of MATLAB Programming 3rd Edition Chapman


Solutions Manual

https://testbankfan.com/product/essentials-of-matlab-
programming-3rd-edition-chapman-solutions-manual/

MATLAB for Engineers 5th Edition Moore Solutions Manual

https://testbankfan.com/product/matlab-for-engineers-5th-edition-
moore-solutions-manual/

Business Statistics 10th Edition Groebner Solutions


Manual

https://testbankfan.com/product/business-statistics-10th-edition-
groebner-solutions-manual/
Physical Universe 15th Edition Krauskopf Test Bank

https://testbankfan.com/product/physical-universe-15th-edition-
krauskopf-test-bank/

Campbell Biology Concepts and Connections 9th Edition


Taylor Test Bank

https://testbankfan.com/product/campbell-biology-concepts-and-
connections-9th-edition-taylor-test-bank/

Building Your Dream Canadian 10th Edition Good Test


Bank

https://testbankfan.com/product/building-your-dream-
canadian-10th-edition-good-test-bank/

Intermediate Algebra with Applications and


Visualization 5th Edition Rockswold Test Bank

https://testbankfan.com/product/intermediate-algebra-with-
applications-and-visualization-5th-edition-rockswold-test-bank/

Principles and Practice of Physics 1st Edition Eric


Mazur Test Bank

https://testbankfan.com/product/principles-and-practice-of-
physics-1st-edition-eric-mazur-test-bank/
Understanding Psychology 10th Edition Morris Test Bank

https://testbankfan.com/product/understanding-psychology-10th-
edition-morris-test-bank/
7. Advanced Features of User-Defined Functions
7.1 Function random1 produces samples from a uniform random distribution on the range [-1,1). Note that
function random0 is a local function (or subfunction) of this function, since it appears in the same file
below the definition of random1. Function random0 is only accessible from function random1, not
from external functions. This is different from the behavior of the function random0 included with the
function random1 written in Exercise 6.29.

function ran = random1(n,m)


%RANDOM1 Generate uniform random numbers in [1,1)
% Function RANDOM1 generates an array of uniform
% random numbers in the range [1,1). The usage
% is:
%
% random1() -- Generate a single value
% random1(n) -- Generate an n x n array
% random1(n,m) -- Generate an n x m array

% Define variables:
% m -- Number of columns
% n -- Number of rows
% ran -- Output array

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(1,2,nargin);
error(msg);

% If both arguments are missing, set to 1.


% If the m argument is missing, set it to n.
if nargin < 1
m = 1;
n = 1;
elseif nargin < 2
m = n;
end

% Initialize the output array


ran = 2 * random0(n,m) - 1;

function ran = random0(n,m)


%RANDOM0 Generate uniform random numbers in [0,1)
% Function RANDOM0 generates an array of uniform
% random numbers in the range [0,1). The usage
% is:
%
% random0(n) -- Generate an n x n array
% random0(n,m) -- Generate an n x m array

185
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Define variables:
% ii -- Index variable
% ISEED -- Random number seed (global)
% jj -- Index variable
% m -- Number of columns
% msg -- Error message
% n -- Number of rows
% ran -- Output array
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 02/04/14 S. J. Chapman Original code
% 1. 04/05/15 S. J. Chapman Modified for 0 arguments

% Declare global values


global ISEED % Seed for random number generator

% Check for a legal number of input arguments.


msg = nargchk(0,2,nargin);
error(msg);

% If both arguments are missing, set to 1.


% If the m argument is missing, set it to n.
if nargin < 1
m = 1;
n = 1;
elseif nargin < 2
m = n;
end

% Initialize the output array


ran = zeros(n,m);

% Test for missing seed, and supply a default if necessary.


if isempty(ISEED)
ISEED = 99999;
end

% Now calculate random values


for ii = 1:n
for jj = 1:m
ISEED = mod(8121*ISEED + 28411, 134456 );
ran(ii,jj) = ISEED / 134456;
end
end

186
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
7.2 Function randomn produces samples from a uniform random distribution on the range [low,high). If
low and high are not supplied, they default to 0 and 1 respectively. Note that function random0 is
placed in a folder named private below the folder containing randomn. Function random0 is only
accessible from function in the parent directory, not from other functions. A listing of the directory is
shown below:

C:\Data\book\matlab\5e\soln\Ex7.2>dir /s
Volume in drive C is SYSTEM
Volume Serial Number is 9084-C7B1

Directory of C:\Data\book\matlab\5e\soln\Ex7.2

02/05/2015 01:16 PM <DIR> .


02/05/2015 01:16 PM <DIR> ..
02/05/2015 01:16 PM <DIR> private
25/09/2011 11:36 AM 1,297 randomn.m
1 File(s) 1,297 bytes

Directory of C:\Data\book\matlab\5e\soln\Ex7.2\private

02/05/2015 01:16 PM <DIR> .


02/05/2015 01:16 PM <DIR> ..
19/05/2015 06:01 PM 1,473 random0.m
1 File(s) 1,473 bytes

Total Files Listed:


2 File(s) 2,770 bytes
5 Dir(s) 79,965,483,008 bytes free

C:\Data\book\matlab\5e\soln\Ex7.2>

Function randomn is shown below:

function ran = randomn(n,m,low,high)


%RANDOMN Generate uniform random numbers in [low,high)
% Function RANDOM1 generates an array of uniform
% random numbers in the range [low,high), where low
% and high are optional parameters supplied by the user.
% If not supplied, low and high default to 0 and 1,
% respectively. The usage is:
%
% random1(n) -- Generate an n x n array
% random1(n,m) -- Generate an n x m array

% Define variables:
% high -- Upper end of range
% low -- Lower end of range
% m -- Number of columns
% n -- Number of rows
% ran -- Output array

% Record of revisions:
% Date Programmer Description of change
187
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(1,4,nargin);
error(msg);

% If arguments are missing, supply the default values.


if nargin < 2
m = n;
low = 0;
high = 1;
elseif nargin < 3
low = 0;
high = 1;
elseif nargin < 4
high = 1;
end

% Check that low < high


if low >= high
error('Lower limit must be less than upper limit!');
end

% Initialize the output array


ran = (high - low) * random0(n,m) + low;

The following function appears in a directory name private below the directory containing function
randomn:

function ran = random0(n,m)


%RANDOM0 Generate uniform random numbers in [0,1)
% Function RANDOM0 generates an array of uniform
% random numbers in the range [0,1). The usage
% is:
%
% random0(n) -- Generate an n x n array
% random0(n,m) -- Generate an n x m array

% Define variables:
% ii -- Index variable
% ISEED -- Random number seed (global)
% jj -- Index variable
% m -- Number of columns
% msg -- Error message
% n -- Number of rows
% ran -- Output array
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 02/04/14 S. J. Chapman Original code
% 1. 04/05/15 S. J. Chapman Modified for 0 arguments
188
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Declare global values
global ISEED % Seed for random number generator

% Check for a legal number of input arguments.


msg = nargchk(0,2,nargin);
error(msg);

% If both arguments are missing, set to 1.


% If the m argument is missing, set it to n.
if nargin < 1
m = 1;
n = 1;
elseif nargin < 2
m = n;
end

% Initialize the output array


ran = zeros(n,m);

% Test for missing seed, and supply a default if necessary.


if isempty(ISEED)
ISEED = 99999;
end

% Now calculate random values


for ii = 1:n
for jj = 1:m
ISEED = mod(8121*ISEED + 28411, 134456 );
ran(ii,jj) = ISEED / 134456;
end
end

When this function is used to generate a 4 x 4 array of random numbers between 3 and 4 the results are: :

>> randomn(4,4,3,4)
ans =
3.7858 3.0238 3.4879 3.5630
3.5319 3.0040 3.3435 3.0988
3.4300 3.5385 3.0946 3.6670
3.1507 3.1958 3.6362 3.9179

7.3 A single function hyperbolic that calculates the hyperbolic sine, cosine, and tangent functions is shown
below. Note that sinh, cosh, and tanh are subfunctions here.

function result = hyperbolic(fun,x)


% HYPERBOLIC Calculate the hyperbolic sine of x
% Function HYPERBOLIC calculates the value of a hyperbolic
% sin, cos, or tan, depending on its its input parameter.

% Define variables:
% fun -- Function to evaluate
189
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% x -- Input value
% result -- Result of calculation

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(2,2,nargin);
error(msg);

% Calculate function
switch (fun)
case 'sinh',
result = sinh(x);
case 'cosh',
result = cosh(x);
case 'tanh',
result = tanh(x);
otherwise,
msg = ['Invalid input function: ' fun];
error(msg);
end

function result = sinh1(x)


%SINH1 Calculate the hyperbolic sine of x
% Function SINH1 calculates the hyperbolic sine of
% its input parameter.

% Define variables:
% x -- input value
% result -- Result of calculation

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(1,1,nargin);
error(msg);

% Calculate value.
result = (exp(x) - exp(-x)) / 2;

function result = cosh1(x)


%COSH1 Calculate the hyperbolic cosine of x
% Function COSH1 calculates the hyperbolic cosine of
% its input parameter.

190
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Define variables:
% x -- input value
% result -- Result of calculation

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(1,1,nargin);
error(msg);

% Calculate value.
result = (exp(x) + exp(-x)) / 2;

function result = tanh1(x)


%COSH1 Calculate the hyperbolic tangent of x
% Function TANH1 calculates the hyperbolic tangent
% of its input parameter.

% Define variables:
% x -- input value
% result -- Result of calculation

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(1,1,nargin);
error(msg);

% Calculate value. Note that we are using the


% array division "./" so that we get the correct
% answer in case an arry input argument is passed
% to this function.
result = (exp(x) - exp(-x)) ./ (exp(x) + exp(-x));

7.4 A program to create the three specified anonymous functions, and then to plot h ( f ( x ) , g ( x) ) over the
range −10 ≤ x ≤ 10 is shown below:
% Script file: test_anonymous.m
%
% Purpose:
% To create three anonymous functions, and then create a
% plot using them.
%
191
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code
%
% Define variables:
% f -- Function handle
% g -- Function handle
% h -- Function handle
% x -- Input data samples

% Create anonymous functions


f = @ (x) 10 * cos(x);
g = @ (x) 5 * sin(x);
h = @ (a,b) sqrt(a.^2 + b.^2);

% Plot the functiion h(f(x),g(x))


x = -10:0.1:10;
plot(x,h(f(x),g(x)));

When this program is executed, the results are:

7.5 The commands to plot the function f ( x) = 1/ x over the range 0.1 ≤ x ≤ 10.0 using function fplot
are shown below:

fplot(@(x) 1/sqrt(x), [0.1 10]);


title('Plot of f(x) = 1 / sqrt(x)');

192
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
xlabel('\bfx');
ylabel('\bff(x)');
grid on;

When these commands are executed, the results are:

7.6 A script file to find the minimum of the function y ( x ) = x 4 − 3 x 2 + 2 x over the interval [0.5 1.5] using
function fminbnd is shown below:

% Script file: test_fminbnd.m


%
% Purpose:
% To test function fminbnd using an anonymous function
% as an input fucntion.
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code
%
% Define variables:
% minloc -- Location of minimum
% minval -- Value at minimum
% y -- Function handle
% x -- Input data samples

% Create anonymous function


y = @ (x) x.^4 - 3*x.^2 + 2*x;

193
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Find the minimum of the function in the range
% 0.5 <= x <= 1.5.
[minloc,minval] = fminbnd(y,0.5,1.5);
disp(['The minimum is at location ' num2str(minloc)]);

% Plot the function


z = linspace(-4,4,100);
plot(z,y(z));
grid on;
xlabel('\bfx');
ylabel('\bfy');
grid on;

When this program is executed, the results are:

>> test_fminbnd
The minimum is at location 0.99999

7.7 A script file to find the minimum of the function y ( x ) = x 4 − 3 x 2 + 2 x over the interval [0.5 1.5] using
function fminbnd is shown below:

% Script file: test_fminbnd.m


%
% Purpose:
% To test function fminbnd using an anonymous function
% as an input fucntion.
%
% Record of revisions:
194
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code
%
% Define variables:
% minloc -- Location of minimum
% minval -- Value at minimum
% y -- Function handle
% x -- Input data samples

% Create anonymous function


y = @ (x) x.^4 - 3*x.^2 + 2*x;

% Find the minimum of the function in the range


% -2 < x < 2.
[minloc,minval] = fminbnd(y,-2.0,2.0);
disp(['The minimum in the range (-2,2) is at location
' num2str(minloc)]);

% Find the minimum of the function in the range


% -1.5 < x < 0.5.
[minloc,minval] = fminbnd(y,-1.5,0.5);
disp(['The minimum in the range (-1.5,0.5) is at location
' num2str(minloc)]);

% Plot the function


z = linspace(-2.5,2.5,100);
plot(z,y(z));
grid on;
xlabel('\bfx');
ylabel('\bfy');
grid on;

When this program is executed, the results are:

>> test_fminbnd
The minimum in the range (-2,2) is at location -1.366
The minimum in the range (-1.5,0.5) is at location -1.366

195
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
7.8 A script file to create a histogram of samples from a random normal distribution is shown below:

% Script file: test_randn.m


%
% Purpose:
% To create a histogram of 100,000 samples from a random
% normal distribution.
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code
%
% Define variables:
% dist -- Samples

% Get 100,000 values


dist = randn(1,100000);

% Create histogram
hist(dist,21);
title('\bfHistogram of random values');
xlabel('\bfValue');
ylabel('\bfCount');

196
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
When this program is executed, the results are:

>> test_randn

7.9 A Rose Plot is a circular histogram, where the angle data theta is divided into the specified number of
bins, and the count of values in each bin is accumulated. A script file to create a rose plot of samples from
a random normal distribution is shown below:

% Script file: test_rose.m


%
% Purpose:
% To create a rose plot of 100,000 samples from a random
% normal distribution.
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/10/15 S. J. Chapman Original code
%
% Define variables:
% dist -- Samples

% Get 100,000 values


dist = randn(1,100000);

% Create histogram
rose(dist,21);
title('\bfRose Plot of random values');
197
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
xlabel('\bfValue');
ylabel('\bfCount');

When this program is executed, the results are:

>> test_rose

7.10 A function that finds the maximum and minimum values of a user-supplied function over a specified
interval is given below:

function [xmin,min_value,xmax,max_value] = ...


extremes(first_value,last_value,num_steps,func)
%EXTREMES Locate the extreme values of a function on an interval
% Function EXTREMES searches a user-supplied function over
% a user-suppled interval, and returns the minimum and maximum
% values found, as well as their locations.
%
% The calling sequence is:
% [xmin,min_value,xmax,max_value] = ...
% extremes(first_value,last_value,num_steps,func);
%
% where
% first_value = the start of the interval to search
% last_value = the end of the interval to search
% num_steps = the number of steps to use in search
% func = the function to evaluate
%
% The output values are:

198
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% xmin = location of smallest value found
% min_value = smallest value found
% xman = location of largest value found
% max_value = largest value found

% Define variables:
% dx -- Step size
% x -- Input values to evaluate fun at
% y -- Function output

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/12/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(4,4,nargin);
error(msg);

% Create array of values to evaluate the function at


dx = (last_value - first_value) / (num_steps - 1);
x = first_value:dx:last_value;

% Evaluate function
y = feval(func,x);

% Find maximum and minimum in y, and the locations in


% the array where they occurred.
[max_value, ymax] = max(y);
[min_value, ymin] = min(y);

% Get the x values at the locations of the maximum and


% minimum values.
xmax = x(ymax);
xmin = x(ymin);

7.11 A test program that tests function extremes is shown below:

% Script file: test_extremes.m


%
% Purpose:
% To test function extremes.
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/12/15 S. J. Chapman Original code
%
% Define variables:
% max_value -- Maximum value
% min_value -- Minimum value
% xmax -- Location of maximum value
% xmin -- Location of minimum value
199
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Call extremes
[xmin,min_value,xmax,max_value] = extremes(-1,3,201,'fun');

% Display results
fprintf('The maximum value is %.4f at %.2f\n',max_value,xmax);
fprintf('The minimum value is %.4f at %.2f\n',min_value,xmin);

The test function to evaluate is

function y = fun(x)
%FUN Function to test extremes

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 07/21/11 S. J. Chapman Original code

y = x.^3 - 5*x.^2 + 5*x +2;

When this program is run, the results are as shown below. The plot of the function below shows that the
program has correctly identified the extremes over the specified interval.

» test_extremes
The maximum value is 3.4163 at 0.62
The minimum value is -9.0000 at -1.00

200
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
7.12 The function fzero locates a zero in a function either near to a user-specified point or within a user-
specified range. If a range is used, then the sign of the function must be different at the beginning and end
of the range. This suggests a strategy for solving this problem—we will search along the function between
0 and 2 π at regular steps, and if the function changes sign between two steps, we will call fzero to
home in on the location of the root.

Note that we can determine whether the function has changed sign between two points by multiplying them
together and seeing the resulting sign. If the sign of the product is negative, then the sign must have
changed between those two points.

% Script file: find_zeros.m


%
% Purpose:
% To find the zeros of the function f(x) = (cos (x))^2 - 0.25
% between 0 and 2*PI.
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/12/15 S. J. Chapman Original code
%
% Define variables:
% x -- Input values to examine
% y -- Value of the function at x
% zero_index -- Index into the zero array
% zero_loc -- Location of zeros

% Create function
hndl = @ (x) cos(x).^2 - 0.25;

% Evaluate the function at 50 points between 0 and 2*PI.


x = linspace(0,2*pi,50);
y = hndl(x);

% Check for a sign change


zero_loc = [];
zero_index = 0;
for ii = 1:length(x)-1
if y(ii)*y(ii+1) <= 0

% Find zeros
zero_index = zero_index + 1;
zero_loc(zero_index) = fzero(hndl,[x(ii) x(ii+1)]);

% Display results
disp(['There is a zero at at ' num2str(zero_loc(zero_index))]);

end
end

% Now plot the function to demonstrate that the zeros are correct
figure(1);
plot(x,y,'b-','LineWidth',2);
201
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
hold on;
plot(zero_loc,zeros(size(zero_loc)),'ro');
hold off;
title('\bfLocation of Function Zeros');
xlabel('\bfx');
ylabel('\bfy');
legend('Function','Zeros found by fzero');
grid on;

When this program is run, the results are as shown below. The plot of the function below shows that the
program has correctly identified the zeros over the specified interval.

>> find_zeros
There is a zero at at 1.0472
There is a zero at at 2.0944
There is a zero at at 4.1888
There is a zero at at 5.236

7.13 A program to evaluate and plot the function f ( x ) = tan 2 x + x − 2 between −2π and 2π in steps of
π /10 is shown below:
% Script file: eval_and_plot_fn.m
%
% Purpose:
% To find the zeros of the function f(x) = (cos (x))^2 - 0.25
% between 0 and 2*PI.
%
% Record of revisions:

202
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
% Date Programmer Description of change
% ==== ========== =====================
% 04/12/15 S. J. Chapman Original code
%
% Define variables:
% hndl -- Function handle
% x -- Input values to examine
% y -- Value of the function at x

% Create function handle


hndl = @ fun;

% Evaluate the function at 50 points between 0 and 2*PI.


x = linspace(0,2*pi,200);
y = feval(hndl,x);

% Now plot the function


figure(1);
plot(x,y,'b-','LineWidth',2);
title('\bfPlot of function');
xlabel('\bfx');
ylabel('\bfy');
grid on;

When this program is run, the results are as shown below. The plot is shown twice, once at full scale and
once with the maximum y axis value limited to 50, so that the details of the plot can be observed.

>> eval_and_plot_fn

203
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
7.14 A program to find potential targets in a radar’s range/Doppler space is shown below. This program finds
potential targets by looking for points that are higher than all of the neighboring points.

% Script file: find_radar_targets.m


%
% Purpose:
% This program detects potential targets in the range /
% velocity space.
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/12/15 S. J. Chapman Original code
%
% Define variables:
% amp_levels -- Amplitude level of each bin
% noise_power -- Power level of peak noise
% nvals -- Number of samples in each bin

% Load the data


load rd_space.mat

% Calculate histogram
[nvals, amp_levels] = hist(amp(:), 31);

% Get location of peak

204
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
[max_val, max_loc] = max(nvals);

% Get the power level of that bin


noise_power = amp_levels(max_loc);

% Now look for targets. A potential target is a point that


% is higher than all of the points around it.
fprintf(' Range Vel Amp SNR\n');
for ii = 2:length(velocity)-1
for jj = 2:length(range)-1

% Is this point bigger than the surrounding ones?


if (amp(ii,jj) > amp(ii+1,jj)) && ...
(amp(ii,jj) > amp(ii-1,jj)) && ...
(amp(ii,jj) > amp(ii,jj+1)) && ...
(amp(ii,jj) > amp(ii,jj-1))

% Yes. This is a potential target.


snr = amp(ii,jj) - noise_power;

% Tell user
fprintf('%7.1f %6.1f %6.1f %6.1f\n', ...
range(jj), velocity(ii), amp(ii,jj), snr);
end
end
end

When this program is executed, the results are:

>> find_radar_targets
Range Vel Amp SNR
-161.9 1.7 -100.9 4.1
-89.9 1.7 -98.8 6.1
125.9 1.7 -95.2 9.7
-143.9 2.5 -107.1 -2.2
-54.0 2.5 -96.8 8.1
-125.9 3.3 -106.3 -1.4
-89.9 4.1 -98.0 6.9
0.0 4.1 -72.3 32.6
125.9 4.1 -102.0 2.9
89.9 5.0 -101.9 3.0
143.9 5.0 -101.3 3.6
-125.9 5.8 -98.6 6.3
107.9 5.8 -104.7 0.2
-72.0 6.6 -96.5 8.4
0.0 6.6 -73.2 31.8
143.9 6.6 -101.3 3.6
-107.9 7.5 -100.7 4.2
-54.0 7.5 -97.7 7.2
107.9 7.5 -102.7 2.2
125.9 8.3 -102.3 2.6
0.0 9.1 -73.9 31.0
205
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
72.0 9.1 -100.5 4.5
107.9 9.1 -102.2 2.8
-161.9 10.8 -99.3 5.6
0.0 10.8 -74.3 30.6
-72.0 11.6 -102.0 2.9
89.9 11.6 -99.5 5.4
0.0 12.4 -74.6 30.3
107.9 12.4 -102.4 2.5
143.9 12.4 -99.2 5.7
-125.9 13.3 -98.7 6.2
89.9 14.1 -106.7 -1.8
-72.0 14.9 -99.7 5.2
0.0 14.9 -74.9 30.0
-125.9 15.8 -97.9 7.0
-89.9 15.8 -98.0 6.9
143.9 15.8 -101.8 3.1
-143.9 17.4 -99.2 5.7
125.9 17.4 -97.4 7.5
143.9 18.3 -99.3 5.7
107.9 19.1 -102.9 2.0
-125.9 19.9 -101.3 3.6
0.0 19.9 -75.2 29.7
-72.0 20.8 -100.5 4.4
125.9 20.8 -95.7 9.2
-54.0 21.6 -99.8 5.2
-161.9 22.4 -99.9 5.1
-125.9 22.4 -103.1 1.8
0.0 22.4 -75.4 29.5
-107.9 23.2 -103.2 1.7
107.9 23.2 -103.8 1.1
143.9 23.2 -97.7 7.2
-125.9 24.1 -102.5 2.4
0.0 24.1 -75.4 29.5
-72.0 24.9 -103.0 1.9
89.9 24.9 -111.1 -6.2
-161.9 25.7 -99.1 5.8
-107.9 25.7 -96.7 8.3
-54.0 25.7 -97.7 7.2
0.0 25.7 -75.7 29.2
143.9 25.7 -96.5 8.5
107.9 26.6 -99.8 5.1
-161.9 28.2 -98.4 6.5
-125.9 28.2 -100.1 4.8
-72.0 28.2 -105.1 -0.1
0.0 28.2 -75.5 29.4
72.0 28.2 -95.9 9.0
-89.9 29.0 -104.4 0.5
107.9 29.0 -102.0 2.9
-125.9 29.9 -101.4 3.5
0.0 29.9 -75.1 29.8
-72.0 30.7 -96.7 8.2
-143.9 31.5 -100.6 4.4
0.0 31.5 -75.0 29.9
206
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
-125.9 32.4 -102.7 2.2
125.9 32.4 -103.4 1.6
-143.9 33.2 -102.0 3.0
-107.9 34.0 -105.1 -0.2
-72.0 34.0 -101.7 3.3
89.9 34.0 -103.3 1.6
-125.9 34.9 -103.8 1.1
0.0 34.9 -74.8 30.1
125.9 34.9 -100.0 4.9
107.9 35.7 -98.0 6.9
-161.9 36.5 -99.5 5.4
-89.9 36.5 -103.8 1.2
143.9 37.4 -104.3 0.6
-143.9 38.2 -103.7 1.2
-107.9 38.2 -102.0 2.9
-72.0 38.2 -102.4 2.5
0.0 38.2 -74.1 30.8
-161.9 39.0 -98.7 6.2
-125.9 39.8 -103.1 1.8
-54.0 39.8 -98.2 6.7
125.9 40.7 -100.4 4.6
-125.9 42.3 -101.3 3.7
-89.9 42.3 -96.7 8.3
143.9 42.3 -98.2 6.8
107.9 43.2 -103.2 1.8
143.9 44.0 -98.6 6.4
-125.9 44.8 -95.8 9.1
125.9 45.6 -97.5 7.5
-107.9 46.5 -96.4 8.5
-72.0 46.5 -100.9 4.1
-54.0 47.3 -97.4 7.5
107.9 47.3 -102.8 2.1
-143.9 48.1 -100.1 4.8
-107.9 48.1 -99.2 5.7
-161.9 49.0 -98.6 6.3
-125.9 49.0 -98.5 6.4
125.9 49.0 -100.0 4.9
18.0 49.8 -65.4 39.5
-161.9 52.3 -53.5 51.4
-89.9 52.3 -51.7 53.2
18.0 52.3 -10.0 94.9
107.9 52.3 -50.8 54.1
-143.9 55.6 -98.9 6.0
-72.0 56.4 -105.0 -0.0
-89.9 57.3 -98.4 6.5
107.9 57.3 -99.3 5.6
143.9 57.3 -102.7 2.3
-125.9 58.1 -97.9 7.0
89.9 58.1 -104.3 0.6
125.9 58.9 -101.7 3.2
-161.9 59.8 -100.6 4.3
89.9 60.6 -99.8 5.1
143.9 60.6 -100.5 4.4
207
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
-125.9 61.4 -98.6 6.3
-161.9 62.3 -100.1 4.8
89.9 62.3 -102.6 2.4
143.9 62.3 -100.2 4.8
-89.9 63.1 -101.5 3.4
107.9 63.1 -100.8 4.1
-161.9 63.9 -100.0 4.9
-125.9 63.9 -102.3 2.6
0.0 63.9 -62.6 42.4
89.9 64.7 -97.1 7.8
125.9 64.7 -102.8 2.1
0.0 67.2 -21.0 83.9
107.9 69.7 -99.0 6.0
-143.9 70.5 -100.2 4.7
125.9 70.5 -98.9 6.0
-125.9 71.4 -99.2 5.7
-72.0 71.4 -110.0 -5.1
0.0 71.4 -62.5 42.4
89.9 71.4 -101.5 3.4
-107.9 72.2 -104.7 0.2
143.9 72.2 -105.2 -0.3
-161.9 73.0 -101.3 3.7
-89.9 73.0 -102.9 2.0
125.9 73.0 -97.3 7.6
-125.9 73.9 -101.1 3.8
-72.0 73.9 -101.3 3.7
-161.9 74.7 -102.1 2.8
-107.9 74.7 -100.0 4.9
-143.9 75.5 -102.3 2.6
107.9 75.5 -100.5 4.4
-72.0 76.4 -100.3 4.6
-161.9 77.2 -103.7 1.2
-107.9 77.2 -100.7 4.3
125.9 77.2 -103.8 1.1
-125.9 78.0 -102.0 3.0
143.9 78.0 -103.3 1.6
89.9 78.8 -102.7 2.2
-143.9 79.7 -98.0 6.9
-89.9 79.7 -100.4 4.5
125.9 79.7 -96.3 8.6
-107.9 80.5 -100.1 4.8
-54.0 80.5 -102.5 2.4
-125.9 82.2 -98.6 6.3
-89.9 82.2 -99.2 5.8
107.9 82.2 -100.3 4.6
143.9 82.2 -99.4 5.5

Which target has the highest signal to noise ratio? What is the relative range and velocity of that target?

208
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
7.15 A function to calculate the derivative of a sampled function is shown below:

function der = derivative(vector,dx,nsamp)


%DERIVATIVE Take the derivative of a function stored as a vector
% Function DERIVATIVE takes the derivative of a functions stored
% as an input vector if nsamp samples with a spacing of dx between
% samples.
%
% The calling sequence is:
% der = derivative(vector,dx,nsamp);
%
% where
% vector = the input function
% dx = step size between elements of the input vector
% nsamp = the number of elements in the vector

% Define variables:
% dx -- Step size
% x -- Input values to evaluate fun at
% y -- Function output

% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/12/15 S. J. Chapman Original code

% Check for a legal number of input arguments.


msg = nargchk(3,3,nargin);
error(msg);

% Check for a positive step size


if dx <= 0
error('dx must be positive!');
end

% Create array of values to evaluate the function at


der = diff(vector(1:nsamp)/dx);

A program to test function derivative is shown below:

% Script file: test_derivative.m


%
% Purpose:
% To test the function derivative.
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========== =====================
% 04/12/15 S. J. Chapman Original code
%
% Define variables:
% cosx -- cos(x)
% der -- derivative of sin(x)
209
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Random documents with unrelated
content Scribd suggests to you:
thunder, late as it was in the moon-of-falling-leaves, and a wind
sighed through the trees about the Big House, and they heard drops
of rain patter upon the bark roof or fall hissing through the smoke
holes into the two great fires below.
“Perhaps Whispering-leaves has told you how our people believe
that after the birth of a child, its navel string has much to do with its
disposition; so, if a girl, they take that string and bury it under the
house or in the garden to make her fond of home duties; or, if a boy,
they hide it out in the woods so he will like the hunt. Well, my father,
so he told me, took mine to the wood, and hid it in a hollow tree. He
had hardly done this when a thunder-shower came up and drove
him to shelter; coming back on his way home he found the tree,
where he had hidden my navel string, burning. It had been struck by
a Thunder arrow.
“As a boy I knew nothing of the Thunder power except that when
the great, black clouds fringed with yellow, began to pile up in the
west, and others, young and old, looked upon them with dread, I
alone of the village felt no fear. In fact I used to go out naked into
every storm; the crash of thunder was as music to me, the bright
flashes were beautiful, the pelting rain refreshed me. And, in truth, I
do this yet, always stretching out my arms to my Guardian to thank
him for having helped me thus far along the trail.
“But I did not know who my Guardian Spirit actually was until I
had seen some twelve or fourteen snows. About this time my
parents began to act strangely and to speak crossly to me. I did not
understand why I deserved such a change in their feelings, and
many a time I felt alone in the world. They even gave me the
poorest part of the meat they had to eat, and scraps and leavings of
corn bread, and stew that had begun to smell sour.
“One morning I was awakened before dawn by some one
punching me in the ribs with a stick—well I remember how it hurt—
and I heard my father say, ‘We must drive this wretched boy away
from here, I can not stand him any longer. Get up from there, dog-
like!’ and he punched me again. My mother who had always until
lately taken my part in any dispute, took no notice, but bent over the
fireplace, and soon a little fire began to flicker and finally filled our
wigwam with light. She went to the water jar just inside the door,
and I saw her dip into it our oldest, blackest, greasiest gourd cup.
Then she turned to me and her face, usually so kind, seemed hard
as flint. ‘Drink, boy,’ she ordered, handing me that cup, and I
wonderingly obeyed.
“Then my father spoke, handing me a burnt and shriveled shred of
meat no larger than his little finger—a piece full of dirt and grit
where it had fallen to the floor. ‘Eat this, miserable brat,’ he cried,
‘and get away out of my sight.’
“A sudden anger overcame me and I flung the morsel full in his
face and darted for the door. ‘Wait,’ I heard him say, ‘aren’t you
going to blacken your face? And besides I was going to tell you the
rest of it, that you must not come back until you bring with you
something great, but you started out too quick!’ Did I see a fleeting
smile on his stern face? Surely his eyes were twinkling!
“Then it dawned upon me what the matter was; I was expected to
fast for power, and all this seeming abuse was nothing but a sham to
make Those-above-us take pity on me as an outcast, suffering child,
and grant me a vision from which I would gain a Guardian Spirit that
would be my protector through life. Often had I heard older boys
speaking of such things, but I had never realized that I, Rumbling-
wings, was expected to go through the ordeal.
“Then said my father, ‘It seems to me I have heard that some
boys who were driven away from home, had to go up on Wolf
mountain to the east end where there is a little cave that was nice to
lie in while they prayed, because they could look out over the tops of
the trees to the river and the hills beyond. Besides,’ he added, ‘I
expect to go hunting up that way early to-morrow morning and I
shall look into that cave to see if any one is hidden away there.’
“Then indeed I understood, and so under his direction, with my
mother looking on, I rubbed my face with charcoal and, throwing
about my shoulders the oldest and raggedest robe I could find—the
one the dog had been using for a bed beneath the sleeping bench—I
set out.
“All day I lay hungry in that little cave while mosquitoes and deer-
flies from the woods, and fleas from the dog’s robe bit me
unmercifully. Yet I looked out over the valley as calmly as I could,
praying to Those-above-us to take pity on me; yet nothing
happened, except that when the day was nearly spent, a cloud came
up behind me over Wolf mountain and overspread the sky, then
went away grumbling without letting fall a drop of rain. That night,
still hungry, I slept a troubled sleep and next morning, before sun
up, in came my father with a little scrap of meat and a small gourd
of water. As I drew out the cob stopper and drank, he asked me,
‘Have you found anything yet?’ When I replied ‘No,’ he took the
bottle and departed.
“The same things happened on the two following days, and I got
weaker and weaker from hunger, yet saw nothing but the black
cloud every afternoon.
“But on the afternoon of the fourth day when the cloud came
again it brought rain, and heavy thunder, and this, strange as it may
seem, lulled me to sleep. And in my sleep I dreamed that I stood
naked and alone on the bare sand hills by the Great-water-where-
daylight-appears, with nothing but a wooden war club, with its round
head painted red, in my hand. And as I stood arrows came flying
through the air from every direction and whispering past my head,
struck quivering into the ground about me. But not one touched me,
and my heart was unafraid.
“At this point I was awakened by an unusually loud crash of
thunder and I opened my eyes to see the shower moving off across
the valley, carrying with it a bow of beautiful colors and followed by
the rays of a lowering sun.
“Somehow I felt satisfied then that I should go home; it was
useless to linger longer in the cave. And so I started, staggering
from weakness among the wet bushes on the mountain side.
“Weak as I was I nearly lost my footing, crossing the swollen
creek, but at last I reached our village. The people looked curiously
at me as I entered and made my way toward our wigwam.
“My father was sitting in front, scraping the charcoal from the
inside of a wooden bowl he had been burning out; some one called
to him, or perhaps he heard my step, and he looked up.
“‘Have you brought it with you, son?’ he asked. On my reply that I
had a dream he seemed very well satisfied and called to my mother
who was looking out of our door. ‘Wife, sweep and fix a place for our
son to sit—he is bringing it with him!’ Mother bustled about then and
swept, and smiling, spread a fresh mat for me; I was surprised at
her air of deference. Down I sat, and after the sun had gone
beneath the edge of the world, she brought me a great bowl of
stew, steaming and delicious, and a new, clean gourd of fresh water.
“That evening they really treated me as a guest. Father even filled
a pipe for me, and then, when my mother’s deep breathing from her
place on the sleeping bench told us that she slumbered, he asked
me outright, ‘What animal spirit or other Manitou has offered himself
to be your helper?’ ‘I do not know,’ I answered, and then I told him
my dream, fearing in my heart that he would think it meant nothing.
“‘Son’, he said when I had finished, ‘you have done better than I
dared to hope, you have indeed gained a powerful friend among
Those-above-us, no less a personage than one of the Thunders!’ And
when I asked him how he knew, he replied, ‘The wooden war club
with a round head painted red is the emblem of the Thunder-Beings,
and represents the fearful blows they strike. The fact that, while you
held this club in your hand, the arrows did not wound you, means
that your Guardian Spirit, the Thunder, will protect you. Don’t you
understand?’
“All that night in my dreams I was struggling and fighting, with
whom I know not, but through it all I heard myself singing,
In my trouble
In my trouble
I call upon my Helper
And his answer
Out of a dark sky
It comes rumbling,
It comes rumbling!

“And this ever since has been my war song, and the song I sing at
our great autumn ceremony in the Big House, where all who have
been so blessed sing of their visions.”...
“So that,” I said, as Rumbling-wings finished, “is why you wear
that little, red, war club hanging about your neck! Now tell me why I
carry a little stone face in the same way. I have tried to take it off
several times, but Whispering-leaves will not let me.”
“That,” replied the old man, “represents Misinghalikun, the living
Mask-Being, and a powerful Manitou he is, for the Great Spirit has
given him control of all the wild animals of the forest. He is the
Guardian Spirit of Flying-wolf, whose body you occupy, but I cannot
tell you the story of his vision. No one could tell you that story but
Flying-wolf himself. And where is he? You occupy his body, but I
doubt if Misinghalikun will help you as he did him. I believe Flying-
wolf won his great fame as a hunter through the power of this
Guardian Spirit, and without that, you may have a hard time to live
up to his reputation.” And, I must say, so I found it.
Another evening I asked Rumbling-wings if his Guardian Spirit
ever helped him in later years.
“Many times, and I will tell you some instances. When I had seen
about twenty snows, I went with some of our kinsfolk to visit the
Minsi, our allies living above us on Lenape River and in the
mountains to the north and east of us here. You may have heard
that, although their language is quite a little different from our
Unami tongue, they too call themselves Lenape and their customs
are almost the same as ours. From there we went with some of
these people eastward across the mountains to see the Great River
of the Mahicans of which we had often heard. Arriving at the river,
we wished to cross to visit a Mahican village just opposite, but,
although we made a signal smoke, no one dared put out from the
village with a canoe to get us because there was a high north wind
and the wide river was very rough. So I burned tobacco and prayed
to my helper, the Thunder, and soon thunder-clouds arose in the
west, and a west wind sprung up which killed the north wind and
left the river smooth; and then the Mahican canoes came for us. We
spent many pleasant days in their village, feasting and dancing, and
visiting from one wigwam to another. Their language is very much
like the Minsi, and enough like ours so that we could understand
almost everything.
“Another time a war party of us Lenape set forth against the
Susquehannocks, a tribe like the Mengwe. They lived on Muddy
River in a big village circled about with a great stockade of
sharpened logs, twice as high as a man, set on end almost touching
one another. Time and time again we attacked them, but could not
break through this stockade, nor could we pile fire against it to
destroy it, so well did their bowmen defend it.
“At last we withdrew a little way to counsel and our war chiefs said
to me, ‘We must depend on you, Rumbling-wings, to help us
overthrow this people who have harassed us so long. Call on your
Guardian Spirit; help us to take this village!’
“And so, as there were no thunder-clouds in sight, I drew from my
medicine bag a few scales of the Great Horned Serpent and laid
them on a rock beside a little creek. You know how the Thunders
hate these great snakes, and always begin to gather, the instant one
of them shows any part of himself above the water. Well even these
scales seem to attract them; I always use these scales to call the
Thunders when I need them.
“Immediately the sky began to darken in the west—so I built a
little fire, threw an offering of tobacco upon it, and prayed to my
Guardian.
“Blacker and blacker grew the sky, nearly as dark as night. We
could hardly see the yellow scud flying overhead beneath the mass
of cloud. The air near the earth seemed hot, choking. All at once a
few great drops of rain splattered down, and then we heard the roar
of a mighty rain approaching across the forest. Soon it was pouring
down about us like a water-fall.
“How long this downpour lasted I know not, but it stopped as
suddenly as it began, and a few large hailstones fell, so large that
we could hear them rattle on the bark roofs of the village. Then
came a deeper roar out of the southwest, louder and louder, nearer
and nearer. Suddenly a great thing rushed past us in a cloud of
flying leaves and broken branches, and struck the village with a
crash, full in the middle, and in a moment was gone. As it passed on
we saw it; it looked like a great, twisting strand of long hair hanging
from the clouds and dragging along the earth, sweeping before it
the trees and the wigwams.
“The instant it passed, we saw that the log stockade was down
and most of the houses of the village, but just then came another
blinding flood of rain which held us back, and when we finally
reached our goal we found a number of the Susquehannocks lying
dead amid the ruins of their houses; and of those who were left
alive and able to run, all were in flight somewhere in that rain-swept
forest.
“As to the wounded, we dispatched those too badly hurt to take
with us, and seized the rest as captives, and then, with all the
weapons, pipes, beautiful clothing and ornaments we could carry, we
made our way homeward. Thus the Thunder, my Guardian Spirit,
helped me, and helped me to raise my name to what it is to-day.
“What finally became of the captives, do you ask? A few we killed
by torture, in revenge for what their people had done to us; some
died; some we let go free after a year or two; others finally
intermarried with our people and cast their lot with us. You know
Traveling-everywhere’s wife? She was one of those captives, given
as a servant to his parents. She was but a young girl, and Traveling-
everywhere, himself but little older, took pleasure in teaching her to
speak our Lenape language. They got to liking each other so well
that they finally built a wigwam of their own. Now you could hardly
tell her from one of us.”
I found it much easier to assimilate these beliefs and stories than
to learn the every-day, practical side of Lenape life, at which I
proved a tragic failure. Although I studied the methods of
experienced hunters I never could master the knack of effective
shooting with the bow and arrow. And I tried my best. Seldom could
I bring down a deer. The neighbors grew tired of providing meat for
me and my family.
Whispering-leaves did her part to perfection; everything she made
or produced was of the very best, which made me feel my
shortcomings all the more. And she would not let me touch the
garden—the only thing I knew anything about. “Garden work is not
manly,” she would say. “I will not endure hearing the neighbors talk
about my mate doing woman’s work. How would you feel if you saw
me going out of the village with a long bow on my shoulder? Or
burning out a log for a canoe? Would you not feel shame to see your
mate do an unwomanly thing? In our life, the man and woman must
do each his or her part and neither is harder than the other. Surely
to hunt all day and every day, good weather and bad, is fully as hard
as wielding the hoe! How would you like to hear the neighbors say,
‘Whispering-leaves ought to give Flying-wolf the skirt, and she put
on his long leggings and breechclout?’”
I was even a failure at finishing her wooden bowl, although I had
watched a number of men making such things and thought I had
learned their method. I heaped hot coals on that maple burl, blew
them until they burned deep, and scraped out the charcoal with
shells and bits of flint again and again, until I thought I had it
hollowed deep enough. Then I ground it patiently with bits of gritty
sandstone. When I had finished, I thought I had accomplished a
very good piece of work for a beginner. But Whispering-leaves,
although she smiled and said sweet words when I laid it finished
before her, and pretended to think it perfect, tucked it away after a
few days, and when we had visitors and a big bowl was needed, she
borrowed another bowl from the neighbors.
What hurt me worst was seeing her treasured finery disappear bit
by bit, doubtless traded for meat and for skins to make our
moccasins and every-day garments. First it was the seed beads,
then those of bone, then one string of shell beads after another until
only the copper beads were left. Finally they too were missing when
I came home one night. One day I had occasion to search beneath
the sleeping benches for something and had to pull out the square
basket in which she kept her treasures, her prettiest embroidered,
festival attire. The basket felt so light that I looked into it—and found
it empty.
Often the boy came in crying and said that his little companions
would not let him play with them because, they said, his father was
“no good.”
And one night Rumbling-wings told me that he had seen the spirit
of Flying-wolf in a dream the night before, and that he said he was
living in a strange land and wanted to come back to his home.
But the crisis came when I returned one night, tired out from my
fifteenth successive fruitless day’s hunting, and found my
Whispering-leaves crying bitterly. Although I begged her to tell me
what the trouble was she refused, but at last she broke down. “My
dear mate,” she sobbed, “there is nothing to eat in this house, and
there is no hope for anything, unless I sell that robe your mother
made for you. All my pretty things are gone long ago, and all yours
except that.”
I caught her to me and held her tight in my arms for a moment,
then dashed out into the night straight to Rumbling-wings’ wigwam.
“I am ready,” I said....
When I came to myself I was lying beneath the lightning-riven
tree.
It did not take me long to find my place again in the modern
world; but always to this day, when the clouds pile up and the
thunder begins to mutter in the west, I think sadly of my lost
Whispering-leaves and of my friend Rumbling-wings and his Thunder
power.
M. R. Harrington
Tokulki of Tulsa
Tokulki was born in the Muskogee town of Tulsa, in the central part
of what is now Alabama. Like all other Indian babies of that region
he first saw the light in a brush shelter some distance back from his
mother’s home; for were he to be born in the latter it was thought
misfortune might fall upon all its occupants. His name belonged to
the Wind clan of Tulsa, and means two persons running. When the
first bearer of the name was born, his father was absent on a war
expedition during which he frightened two of his enemies who were
on scout duty, so thoroughly that they ran off in haste, leaving their
weapons in his hands. It was in commemoration of this event that
the new-born babe received his name.
Tokulki’s mother was waited upon during her period of seclusion
by her own mother and another old woman of the clan, reputed
most skillful in midwifery. Although it was late in the autumn this old
woman took the infant immediately to the bank of the river and
plunged him into it, after which he was strapped securely into a
cradle, made of canes, by means of bark cords about the shoulders
and thighs. Here Tokulki spent the next few months of his life,
sometimes carried on his mother’s back, sometimes propped up
against the wall of the house while his mother was engaged in her
household duties. But whenever he was so placed, the cradle was
allowed to rest upon a panther skin, for his father and his uncles had
all been famous warriors and it was expected that he would follow in
their footsteps. Therefore he must have that about him which would
communicate a warlike essence and make him fierce and bold.
Tokulki passed through the period when his principal experience of
life was that there was something in it that gave him food and
warmth, which was “mother,” and when there was something light in
which dark objects moved, or something dark in which light objects
moved. There was one particular light object that he gazed upon
continually, and which resolved itself into the house door, and
another, red and hot, which he saw when he awoke at night and
which resolved itself into the house fire.
The home into which he gradually came to consciousness was the
winter house of his family. The framework was of hickory poles, set
in a circle of perhaps twenty-five feet in diameter, with their slender
ends gathered together at the top and supported by a central
element of four wooden columns. Interwoven with this were thin,
flexible pieces of wood plastered thickly with mud mixed with dry
grass, and the whole covered inside and out with mats. The floor
was excavated a couple of feet below the general level of the
ground, and a shallow trench dug about it a little farther back, so
that water would be carried off without entering. The doorway which
had so early attracted Tokulki’s attention was to the east where the
first rays of the sun could steal into it, but it was seldom that it
found any one but very young babies to awaken, for the duties of
the day were assumed early and ended soon, except in times of
merry-making or the great ceremonials. There was no vent for the
escape of smoke which sometimes accumulated to an extent which
would render the inside unendurable to a white man; but this was
partly provided against by the judicious selection of wood,—old
sticks of oak and hickory which would fall apart with little smoke,
and leave a glowing bed of coals to radiate heat during much of the
night. Around the walls of the house was a continuous seat made of
matting, raised a foot and a half to two feet from the floor and
covered with bearskins upon which most of the household slept.
The household consisted of Tokulki’s father and mother, a brother
and sister, his mother’s mother, a married sister of his mother, her
husband and two children, a younger brother of his mother, and an
old man of the Wind clan, not closely connected with the family but
making this his temporary home. More important in Tokulki’s life
than most of these, was an old man, living a short distance away,
but a frequent visitor in the cabin, a man whom we should call
“maternal uncle” in English; yet he was “uncle” not only to Tokulki
and Tokulki’s brother and sister and the children of his mother’s
sister, but to a large number of other boys and girls—boys and girls
whom we should not consider related in the least. Tokulki, however,
as he grew older, learned to call them “elder brothers,” “younger
brothers,” and “sisters,” and he learned that most of these were
called “Wind people,” like himself, but that some were called “Skunk
people,” and some “Fish people.”
While still on his mother’s back, Tokulki was taken down to the
river every morning, and his mother dashed water over him and over
herself even when the weather was bitterly cold. One of his earliest
memories was of this cold douche after his warm night’s rest. All of
the inhabitants of the village except a few of the sick and decrepit,
took this morning bath, the men and boys plunging in, the women
and children contenting themselves in cold weather with a little
splashing.
And it was the “uncle” of each band who saw to it that none
evaded this regulation. He was always present, encouraging the
smaller boys, scolding the timorous, and sometimes correcting the
unruly by means of a stout stick. As he did so he poured good
advice into their ears, and Tokulki soon learned that his “uncle” was
the man to whom he must appeal in time of trouble, whose
approbation he must win, and whose displeasure he must be careful
to shun. Often, on winter evenings the uncle would gather his
“nephews” and “nieces” together and instruct them, and he would
tell them in particular of the deeds of their ancestors, sometimes
assisting his memory by means of little strings of beads, or by
referring to notches cut in sticks.
But when the old people were talking with one another, Tokulki’s
mother would by no means allow him to go near them, and
sometimes, when his curiosity had gotten the better of him, she
would box his ears soundly. In after life Tokulki learned that this was
not because such behavior was considered disrespectful of the old
people or annoying to them, but because old people have uncanny
powers and may bewitch a child who hangs about them too closely.
There was not much temptation to do this except in winter, for
during the rest of the year the elders would be working or talking
apart by themselves, or the old men would be in the square.
This “square” loomed larger in Tokulki’s life the older he grew. It
was only a short distance from his home. He was not allowed to play
there, but he could walk all around the edge, marked by a ridge of
earth which had been piled up by successive scrapings of its surface
in preparation for the ceremonials. Near its western end were four
long, narrow buildings plastered with mud and outlining a hollow
square with entrances at the corners. They were open in front, and
each was divided into three equal sections by transverse walls,
which did not, however, reach to the roof. The middle section of the
western cabin was slightly different, in that the back part was
separated by another wall parallel to the walls of the building, and,
closely shut up in the room thus formed, Tokulki knew that the
ceremonial pots, rattles, drums, the dried medicines, and all of the
most sacred possessions of the tribes were kept. In front the town
chief or miko and his principal councilors had their seats. On the
northwestern edge of the grounds loomed the tshokofa, the indoors
council house, constructed precisely like a winter house except that
it was very much larger. To the eastward extended a wide, open
space kept bare of grass by intermittent hoeing and the pressure of
many feet. In the middle of it rose a ball post, and at the farther
corners stood two shorter posts where captives taken in war were
burned. Almost every morning Tokulki could watch the leading men
of his town assemble in this square, and between the buildings catch
glimpses of the medicine-bearers carrying asi (an infusion of ilex
vomitoria) in conch shells to regale the councilors. All that they had
in their stomachs they forthwith ejected, that they and their minds
might both be clear for the matters about to be discussed.
Frequently Tokulki accompanied his mother when she went in
quest of firewood, or he would sit on the edge of the garden patch
while his mother, his grandmother, and the other women of the
household were at work, and sometimes he was given the
temporarily congenial task of driving off crows. This garden was
planted principally with pumpkins and beans, but most of the corn
was in the great town garden farther off from the village, and thither
all of the people marched in the spring, headed by their miko, with
hoes made of hickory limbs over their shoulders, to prepare the
ground for planting. Each household had its own patch separated
from the rest by a narrow strip of grass, but the work was in
common: first so-and-so’s strip, next some-one-else’s until all was
completed. After that it was largely the duty of the women and
children to keep weeds down and drive away birds, and there were
little watch-houses on the edges of the fields for the accommodation
of the guardians. The days when all worked were as much holidays
as days of labor. The participants began early but worked only until
shortly after noon. Then they partook of their principal meal in
common, and after that there was usually a ball game followed by a
dance around a big fire in the square, the light of which was
reinforced by cane torches.
The ball game was usually played about a single post, though not
the one in the square-ground, and it was indulged in by both men
and women, who played against each other, the women throwing
the ball with their hands, the men with their ball sticks. Single tallies
were made by striking the pole above a certain mark, but five points
were counted if the carved bird which surmounted it was touched.
Sometimes, however, the men played their own game, a game
similar to lacrosse except that two small ball sticks took the place of
the one large one. Each side strove to bring the ball home to its own
goal, marked by two straight poles set up a couple of feet apart, and
twenty points constituted a game, ten sticks being stuck into the
ground by the scorer of each side and then drawn out again. In
dividing up, the Wind, Bear, Bird, Beaver, and some other clans,
called collectively “Whites,” played against the Raccoon, Fox, Potato,
Alligator, Deer, and certain others who were known as “People-of-a-
different-speech.” But these games were only practice games, or
make believe games. The regular games were always between
certain towns, and they were very serious matters conducted with
the deliberation and ritualism of a war expedition. Each game was
preceded by careful negotiations: the players fasted and were
scratched with gar teeth, they enlisted the aid of the supernatural by
employing a medicine man, they marched to the appointed place as
if to meet an enemy, wagered quantities of property on the result,
and conducted it so energetically that serious injuries were
sometimes inflicted.
In winter Tokulki’s mother and the other women busied
themselves making baskets and mats, twisting bison hair into garters
for the leggings, and weaving cloaks—worn only by women—out of
the inner bark of the mulberry. In the summer they made pottery
and dressed skins, and the preparation of food kept them busy, of
course, at all seasons. They must prepare their own flour by
pounding the corn in a wooden mortar, at which they sometimes
worked two and two. Sometimes they would relax their labors long
enough to play a sort of dice game in which sections of cane took
the place of our bits of bone. The men spent most of their winters
seemingly to less advantage, much of it in smoking and recounting
to one another tales of their hunting or war excursions, humorous
sketches frequently revolving about the Rabbit, and sometimes
myths of a more serious and sacred character. However, they
devoted many hours in the aggregate to the repair of their hunting
and fishing outfits, and to the manufacture of axes, arrow points,
and other articles of utility, material for which had been laid aside
during the preceding fall.
When Tokulki was able to run about freely by himself, his uncle
made him a blowgun out of a long, hollow cane which he provided
also with cane arrows with their butt ends wrapped in thistledown.
He sent him out to try his skill upon the birds and smaller game
animals, and more than once Tokulki came home proudly with birds,
squirrels, and even an occasional rabbit. A little later they made him
a bow and arrows, with which he attacked rabbits, and wild turkeys,
and upon one happy occasion, he succeeded in creeping near
enough to a young deer to dispatch it. He came home in triumph to
his mother, telling her where the animal was to be found, and
listened to the praises of his entire household, particularly those of
his uncle, with flushing cheeks.
Upon this Tokulki’s father and uncle began to instruct him in the
arts of woodcraft. They took the head of a deer and placed splints
inside of it so as to restore it as nearly as might be to its original
shape, and showed him how to use it in stalking the living animal.
They taught him how to make traps for the smaller animals, and
where game was to be found. They also taught him that a piece of
flesh must be cut out of every deer that was killed, and thrown away
so that the deer might not be offended and leave the country. They
taught him that he must not cast bones of game animals far off,
when they fed them to their dogs, lest the animals afterward
become shy. He was told that a sprig of old man’s tobacco must be
put under every fire made by the hunting party so that malevolent
spirits would not follow them. Still later he was to learn about certain
medicines and formulæ to insure success in the chase.
As soon as spring came, hunting of a somewhat desultory
character began, but the families did not move far from town until
after the annual ceremonies were over and the corn had been
harvested, unless driven to it by famine, or drawn to certain points
on the rivers by runs of fish. During this time Tokulki accompanied a
hunting party to the bear preserve, a section of forest not far from
Tulsa where bears were numerous and which was the common
property of all the citizens. When the party approached a tree in
which a bear had been located, Tokulki stood at one side to watch
the method of procedure. He saw that one man climbed into a tree
not far from that containing the animal they sought, and was given
blazing slivers of pitch pine which he threw successively into the tree
den. When its occupant was driven out, he was quickly dispatched
by the hunters disposed below. The meat was distributed throughout
the town for immediate consumption, but the fat was tried out and
poured into bags made of whole deerskins which were then packed
away for the winter season. Meanwhile, the women were hunting
through the forests for roots, particularly groundnuts and the roots
of a smilax which they called kunti. They also collected the seeds of
a pond lily; a little later a profusion of berries enables them to vary
their diet.
In April the miko called his leading men together and shortly
afterwards was held the first ceremony of the season accompanied
by fasting and the drinking of the red willow and button-snake root.
At the time of the corresponding full moons in May and June, similar
ceremonies took place, but these were merely in preparation for the
great Fast (poskita), the culmination of the Southeastern religious
season. And so it was that about the middle of July a messenger
appeared at Tokulki’s home, and delivered to the house chief a little
bundle of sticks tied with deer sinew. Before handing it over, he
drew one stick from the bundle and threw it away. Every morning
thereafter the house chief did the same until but one stick remained
and on that day the ceremony began. Similar bundles were carried
to every household of Tulsa Indians far or near, all of whom
synchronized their movements in such a way as to converge on the
square-ground at the time appointed. Failure to come in then was
both impiety and treason, and it was severely punished by the
warrior class known as tastanagalgi, who would handle the absentee
severely, and destroy or confiscate his property.
The poskita was the type of all the ceremonials of the tribes of the
Southeast. The active participants were those men who had been on
war expeditions and had received new names in consequence,
names usually ending hadjo, fiksiko, imala, tastanagi, or yahola, and
containing often the names of the clan animals, the towns of the
Creek confederacy, or even foreign tribes. Generally speaking, the
miko and the members of his clan sat in the west cabin, the “second
men,” or henehalgi, who were devoted to peace, in the south cabin,
the higher classes of warriors on the north, and the common
warriors on the east. Each cabin or “bed” contained from two to four
“honored men,” retired warriors who constituted the inner council in
charge of the ceremony. This poskita was distinctly a peace
ceremony when old enmities were forgotten, all but the most
heinous crimes pardoned, and new resolutions made for the ensuing
year.
At least one day was devoted to feasting, but after that a rigid fast
was observed by all the active participants. Then those who had
performed brave actions received new names and new war honors,
while novitiates were shut up in the tshokofa and a strict fast was
imposed upon them preparatory to their admission into the class of
warriors and induction into adult life. During this ceremony, too, all
of the fires, which were supposed to have become corrupt from
contamination with worldly things during the year, were
extinguished, and a new fire was lighted by the “Medicine Maker,”
the high priest of the town, in the most impressive manner by
means of the common fire drill. This new fire was first used to
replace the fires in the square-ground and the tshokofa, and
afterwards it was taken to one side of the square where the women
stood ready to receive it and carry it to their several homes. The
rituals extended over eight days, and on the last, just at sunset, the
men marched in single file to the river, led by one of the Fish clan
bearing a feather wand, and all plunged into its waters. They
returned in the same order, the miko made a short farewell address,
and the ceremony was over.
From this time until the harvest had been gathered in, Tokulki’s
people, and most of the others, did not stray far from town. In
October was a sacred ceremony called the “Polecat dance,” and
afterward the people began to scatter rapidly for their fall hunting.
Some proceeded to their camps overland, the women serving as
beasts of burden; but the greater number, including Tokulki’s family,
had their hunting lodges near the rivers and reached them by means
of canoes made of single trees, fire-felled and fire-excavated. Some
parties went as many as seventy-five or a hundred miles from home,
especially when they desired to hunt the woodland bison. This
season was devoted especially to the preparation of quantities of
dried venison against the coming of winter.
When game was plentiful, a series of merry-makings were
indulged in. This usually began with the presentation of a ball, made
of buckskin, to one of the men by his sister-in-law, who at the same
time intimated that she desired venison, bear meat, or occasionally
squirrels. Upon receiving this challenge, the man communicated the
intelligence to all of the other men in camp and they set out on a
grand deer, bear, or squirrel hunt as the case might be. Meantime
the women busied themselves pounding corn, or perhaps kunti
roots, into flour and preparing various sorts of dishes. When the
men returned they also took the meat in hand and a great feast
followed, with a ball game of the single pole type, and a dance to
close the day. They would light a great fire and two men would
station themselves near it, one with a drum made by stretching a
deerskin over an earthen pot or cypress knee, the other with a
gourd rattle, while the dancers went around the fire, usually
sinistrally, in single file or two-and-two, under the charge of one or
two leaders. The dances were usually named after animals, real or
imaginary, and the steps and other motions were supposed to be in
imitation of them. The men did most of the singing.
After a few days there would be another presentation of a ball and
the same feasting, ball playing, and dancing would follow, and this
was frequently kept up until the weather was very cold.
Sometimes sickness came upon a member of Tokulki’s camp, and
then Tokulki’s mother’s younger brother, who was doctor of the
band, and at the same time Medicine Maker of the town, would be
called in. Before prescribing, such a doctor often consulted the kila,
or “knower,” who seems to have combined the functions of prophet
and diagnostician, but Tokulki’s uncle never did this because he
united the two functions in himself. Having determined the nature of
the disease, he would go in quest of various herbs, or sometimes
send members of the household after them. These he put into a
great pot, poured water over them, and placed the pot over the fire.
After the contents were sufficiently heated, he gave it potency by
breathing into it through a hollow cane, while repeating a magical
formula. This was done four times, the doctor meantime facing east.
Sometimes, however, he prescribed sweat bathing in a lodge made
of blankets thrown over poles, and containing heated rocks on which
water was poured, and sometimes he declared the trouble was
caused by witchcraft which he proceeded to cure by sucking the
witching object out of the affected part by means of a bison horn.

You might also like