Contents

Aaron Klapheck

% Ch 5. Assignment #12       due 11/28
clear, clc
Date = date
Date =

12-Dec-2007

Problem 16

Elongation = [0:1:10];
Elongation_without_0 = [1:1:10];
Increasing_tension = [0, 3500, 6300, 9200, 11500, 13000, 13500, ...
    13900, 14100, 14300, 14500];
Decreasion_tension = [0, 3000, 6000, 8800, 11100, 12300, 13500, 14000, ...
    14300, 14500];

plot(Elongation, Increasing_tension, '*--', Elongation_without_0, ...
    Decreasion_tension, 'o--'), title('Strain vs. Tension'), ...
    xlabel('Elongation (in.*10^-3)'), ylabel('Tension Force (lb)'), ...
    gtext('Increasing Tension'), gtext('Decreasing Tension')

Problem 19

% Given
% Ideal Gas Law: pV = mRT.
% R = 286.7 N*m/(kg*K)
% T = 293 K
% m_1 = 1 kg, m_2 = 3 kg, m_3 = 7 kg
% V in m^3: 20 <= V <= 100

% Find
% Three curves (one for each of the three different masses) where p is
% plotted vs. V.
% p = mRT/V

V = [20:0.1:100];
m_1 = 1; m_2 = 3; m_3 = 7;

RT_V = 286.7*293./V;

plot(V, m_1*RT_V, V, m_2*RT_V, V, m_3*RT_V), xlabel('Volume (m^3)'), ...
    legend('m = 1kg', 'm = 3kg', 'm = 7kg'), ylabel('Pressure (Pa)'), ...
    title('Pressure vs. Volume of Air at 293 Kelvin')

Problem 21

time = [1:8, 10];
speed = [1210, 1866, 2301, 2564, 2724, 2881, 2879, 2915, 3010];

% Approximate speed vs. time with s(t) where s(t) = b(1-e^(ct)).
% s_of_t = b(1 - exp(ct)), c is going to be negative.
% As time approaches infinity f(t) approches ~3010.
% Therefore b = 3010.
% At t = 1 f(t) = 1210, therefore c = -0.51415

b = 3010; c = -0.51415;

t = [1:0.01:10];
s_of_t = b.*(1 - exp(c.*t));

% The function can discribe the data.

% Graph to ensure that the function matches our data.
plot(time, speed, 'o--', t, s_of_t), title('Rotational Speed vs. Time'), ...
    xlabel('Time (sec)'), ylabel('Speed (rpm)'), ...
    gtext('Function Approximation'), gtext('Data')

Problem 22 - Stem plot

Year = [1990, 1991, 1992, 1993, 1994];
Temp = [18, 19, 21, 17, 20];

stem(Year, Temp), title('Average Temperature vs. Time'), ...
    xlabel('Time (years)'), ylabel('Temperature (degrees C)')

Problem 22 - Bar plot

bar(Year, Temp), title('Average Temperature vs. Time'), ...
    xlabel('Time (years)'), ylabel('Temperature (degrees C)')

Problem 22 - Stairs plot

stairs(Year, Temp), title('Average Temperature vs. Time'), ...
    xlabel('Time (years)'), ylabel('Temperature (degrees C)')

Problem 30 - a.

% Find the best function that describes the data for a through c.

% a.

x = [25, 30, 35, 40, 45];
y = [5, 260, 480, 745, 1100];

plot(x, y, 'o')

% x and y appear to form a linear relationship.

p = polyfit(x, y, 1);
f_of_x = p(1).*x + p(2);

plot(x, y, 'o', x, f_of_x), xlabel('x'), ...
    title('Finding a Function to Fit the Data'), ylabel('y'), ...
    legend('Data', 'Approximating Function')

Problem 30 - b.

x = [2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 7, 8, 9, 10];
y = [1500, 1220, 1050, 915, 810, 745, 690, 620, 520, 480, 410, 390];

plot(x, y, 'o')

% x and y appear to conform to an exponential decay function. I tried this
% and the exponential function did not fit the data well.
% x and y appear to convorm to a power function.

p = polyfit(log10(x), log10(y), 1);
m = p(1);
b = 10.^p(2);

x_2 = [2.5:0.1:10];
f_of_x = b.*x_2.^m;

plot(x, y, 'o', x_2, f_of_x), xlabel('x'), ...
    title('Finding a Function to Fit the Data'), ylabel('y'), ...
    legend('Data', 'Approximating Function')

Problem 30 - c.

x = [550, 600, 650, 700, 750];
y = [41.2, 18.62, 8.62, 3.92, 1.86];

plot(x, y, 'o')

% x and y appear to conform to an exponential decay function.

p = polyfit(x, log10(y), 1);
m = p(1);
b = 10.^p(2);

x_2 = [550:1:750];
f_of_x = b.*(10).^(m.*x_2);

plot(x, y, 'o', x_2, f_of_x), xlabel('x'), ...
    title('Finding a Function to Fit the Data'), ylabel('y'), ...
    legend('Data', 'Approximating Function')

Problem 32a,b

% Given
% C(t)/C(0) = e^(-bt).
% C(t)/C(0) = fractional percent of C 14 remaining after time t.
% t = 0 at death and when t is 0 C(t)/C(0) is 1.
% as t approaches infinity C(t)/C(0) approaches 0.
% half life = 5500 year.

Problem 32 - part a

% For t = 5500 years C(t)/C(0) = 50% = 0.5.
% b = -log(C(t)/C(0))/t

t = [0:1:100000];
b = 0.000126;

fraction_of_C14 = exp(-b.*t);

plot(t, fraction_of_C14), xlabel('Time (years)'), ...
    title('Fraction of C14 Remaining Over Time'), ...
    ylabel('Fraction of C14 (unitless)')

Problem 32 - part b

% I use the plot to find the time in years when the fraction of C14 is 90%.
% C(t)/C(0) = 0.9 at around t = 800

t = [800:1:850];
b = 0.000126;

fraction_of_C14 = exp(-b.*t);

plot(t, fraction_of_C14), xlabel('Time (years)'), ...
    title('Fraction of C14 Remaining Over Time'), ...
    ylabel('Fraction of C14'), grid, ...
    [Years_ago_died, Fraction_of_C14] = ginput(1)
Years_ago_died =

  836.4631


Fraction_of_C14 =

    0.9000