blob: bb0f02f8b09ba2143c258d11ea568fab519408d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//Example number 7.7, Page number 7.15
clc;clear;close
// Variable declaration
n=1 // unitless
lamda=1.54// in m
theta=32*%pi/180 // radian
h=2// in m
k=2// in m
l=0// in m
// Calculations
d=(n*lamda*10^-10)/(2*sin(theta)) // derived from 2dsin(theta)=n*l
a=d*(sqrt(h^2+k^2+l^2))//in m
// Results
printf("d = %.2e m",d)
printf("\na = %.1e m",a)
|