Contents
Aaron Klapheck
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 18-Mar-2008 16:00:00
Tasks 1
1. Task 1. Read a Data File w/o Headings
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: Reading files %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
fileID = fopen('cucon1_edit.dat', 'r');
Data = fscanf(fileID, '%g', [2,15])';
fclose(fileID);
fprintf('cucon1_edit.dat containes: \n')
Data
fprintf('cucon1_edit.xls containes: \n')
Data = xlsread('cucon1_edit')
The date and time: 18-Mar-2008 16:00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: Reading files %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cucon1_edit.dat containes:
Data =
12.2900 25.3500
13.7500 27.8800
14.8200 29.9300
16.1200 30.4200
18.0400 31.0000
18.6700 31.9600
20.5200 32.4700
22.6800 30.3300
25.1500 31.1400
27.7200 27.4600
30.2400 23.2900
33.2100 20.7200
36.4800 17.2400
39.8600 14.7100
50.4000 9.5000
cucon1_edit.xls containes:
Data =
12.2900 25.3500
13.7500 27.8800
14.8200 29.9300
16.1200 30.4200
18.0400 31.0000
18.6700 31.9600
20.5200 32.4700
22.6800 30.3300
25.1500 31.1400
27.7200 27.4600
30.2400 23.2900
33.2100 20.7200
36.4800 17.2400
39.8600 14.7100
50.4000 9.5000
2. Task 1. Read a Data File with Headings
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: Reading File with Headings %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
fileID = fopen('emission_edit.dat', 'r');
headings = fgetl(fileID);
Data = fscanf(fileID, '%g', [3,10])';
fclose(fileID);
fprintf('\n emission_edit.dat: \n %s \n',headings)
fprintf('%4.0f \t \t \t %3.0f \t \t \t \t \t \t \t %2.2f \n', Data')
[Data, Text] = xlsread('emission_edit.xls');
Text
Data
The date and time: 18-Mar-2008 16:00:01
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: Reading File with Headings %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
emission_edit.dat:
NO(ppm) humidity(gr/lb_dry_air) atm_pressure(in_Hg)
1500 20 29.30
1420 30 29.50
1430 40 29.40
1270 50 29.35
1200 60 29.70
1100 70 29.60
1120 80 29.55
1015 90 29.80
1040 100 29.78
990 110 29.80
Text =
'NO(ppm)' [1x23 char] 'atm_pressure(in_Hg)'
Data =
1.0e+003 *
1.5000 0.0200 0.0293
1.4200 0.0300 0.0295
1.4300 0.0400 0.0294
1.2700 0.0500 0.0294
1.2000 0.0600 0.0297
1.1000 0.0700 0.0296
1.1200 0.0800 0.0296
1.0150 0.0900 0.0298
1.0400 0.1000 0.0298
0.9900 0.1100 0.0298
3. FSD
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: To Create a Force-Summery Diagram (FSD) %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
tic
A = [sin(pi/4), 0, 0, 0, 0, 0; cos(pi/4), 1, 0, 0, 0, 0; 0, 0, 1, 1, 0, ...
0; 0, 1, 0, 0, 1, 0; cos(pi/4), 0, 1, 0, 0, 0; sin(pi/4), 0, 0, 0, 0, 1];
b = [-5; 0; 0; 0; 0; 0];
x = A\b
toc
tic
A = zeros(6);
A = [sin(pi/4), 0, 0, 0, 0, 0; cos(pi/4), 1, 0, 0, 0, 0; 0, 0, 1, 1, 0, ...
0; 0, 1, 0, 0, 1, 0; cos(pi/4), 0, 1, 0, 0, 0; sin(pi/4), 0, 0, 0, 0, 1];
b = zeros(6,1);
b = [-5; 0; 0; 0; 0; 0];
x = A\b
toc
The date and time: 18-Mar-2008 16:00:02
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: To Create a Force-Summery Diagram (FSD) %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x =
-7.0711
5.0000
5.0000
-5.0000
-5.0000
5.0000
Elapsed time is 0.000000 seconds.
x =
-7.0711
5.0000
5.0000
-5.0000
-5.0000
5.0000
Elapsed time is 0.000000 seconds.