-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_cl_time.m
More file actions
79 lines (65 loc) · 2.4 KB
/
Copy pathplot_cl_time.m
File metadata and controls
79 lines (65 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
%% Import data from text file.
% Script for importing data from the following text file:
%
% D:\computations_dir\oscillating_cylinder\stationary_cylinder_11feb2023\aratio0_fratio1\postProcessing\forceCoeffs_object\0\coefficient.dat
%
% To extend the code to different selected data or a different text file,
% generate a function instead of a script.
% Auto-generated by MATLAB on 2023/02/11 14:37:06
%% Initialize variables.
clear; clc; close all;
filename = ['D:\computations_dir\cavitating_hydrofoil\validation_dir\cavitation_no_cl_re\aoi12_v38\postProcessing\forceCoeffs_object\0\coefficient.dat'];
delimiter = '\t';
startRow = 14;
%% Format string for each line of text:
% column1: text (%s)
% column2: text (%s)
% column3: text (%s)
% column4: text (%s)
% column5: text (%s)
% column6: text (%s)
% column7: text (%s)
% column8: text (%s)
% column9: text (%s)
% column10: text (%s)
% column11: text (%s)
% column12: text (%s)
% column13: text (%s)
% For more information, see the TEXTSCAN documentation.
formatSpec = '%s%s%s%s%s%s%s%s%s%s%s%s%s%[^\n\r]';
%% Open the text file.
fileID = fopen(filename,'r');
%% Read columns of data according to format string.
% This call is based on the structure of the file used to generate this
% code. If an error occurs for a different file, try regenerating the code
% from the Import Tool.
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1, 'ReturnOnError', false);
%% Close the text file.
fclose(fileID);
%% Post processing for unimportable data.
% No unimportable data rules were applied during the import, so no post
% processing code is included. To generate code which works for
% unimportable data, select unimportable cells in a file and regenerate the
% script.
%% Allocate imported array to column variable names
VarName1 = dataArray{:, 1};
VarName2 = dataArray{:, 2};
VarName3 = dataArray{:, 3};
VarName4 = dataArray{:, 4};
VarName5 = dataArray{:, 5};
VarName6 = dataArray{:, 6};
VarName7 = dataArray{:, 7};
VarName8 = dataArray{:, 8};
VarName9 = dataArray{:, 9};
VarName10 = dataArray{:, 10};
VarName11 = dataArray{:, 11};
VarName12 = dataArray{:, 12};
VarName13 = dataArray{:, 13};
length_time = length(VarName1);
for i = 1:length_time
t(i) = str2num(transpose(VarName1{i,1}(:)));
cd(i) = str2num(transpose(VarName2{i,1}(:)));
cl(i) = str2num(transpose(VarName4{i,1}(:)));
end
plot(t(400:end),cl(400:end));
mean(cl(400:end))