summaryrefslogtreecommitdiff
path: root/1847/CH1/EX1.13/Ch01Ex13.sce
blob: 8ed2c8f3187c9eae55ebf9a721358eb3fe096c81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Scilab Code Ex1.13: Page-1.17 (2009)
clc; clear;
theta = 45;     // Diffraction angle, degrees
h = 6.626e-034;     // Planck's constant
m = 1.67e-027;      // Mass of a neutron, kg
n = 1;      // Order of diffraction
k = 1.38e-023;  // Boltzmann constant, J/mol/K
T = 27+273;     // Absolute room temperature, K
E = 3/2*k*T;    // Energy of the neutron, J
lambda = h/sqrt(2*m*E); // de-Broglie wavelength of neutrons, m
// From Bragg's law, 2*d*sin(theta) = n*lambda, solving for d
d = n*lambda/(2*sind(theta));
printf("\nThe interplanar spacing of the crystal = %4.2f angstrom", d/1e-010);

// Result 
// The interplanar spacing of the crystal = 1.03 angstrom