-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModifiedTransientPeakRatio.m
138 lines (121 loc) · 5.6 KB
/
ModifiedTransientPeakRatio.m
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Theory taken from the book Introduction to Flight Test Engineering %%%%
%%% By Ward and Strganac %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Method taken from the appendix of the book Background Information %%%
%%% and User Guide for MIL-F-8785B(ASG) "Military Specification-flying %%%
%%% qualities of Piloted Airplanes" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% By C. R. Chalk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Script made by ohyaiamhere %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Posted on GitHub %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear
question = ['Please enter crest and trough amplitudes as 2nd row,' ...
'time values as 1st row \nAlso, remember to add the [] brackets around' ...
'them when pasting \nFor example : [0 150 \n1 130\n 2 160 \n3 120]' ...
' \n Paste data here : '];
Data = input(question);
clc
% TPRvsDampingRatio = [ -1.979654120040692 0.958387516254877
% -1.955239064089522 0.958387516254877
% -1.910478128179044 0.958387516254877
% -1.875890132248220 0.958387516254877
% -1.847405900305189 0.958387516254877
% -1.804679552390641 0.957087126137841
% -1.768056968463886 0.955786736020806
% -1.729399796541201 0.953185955786736
% -1.692777212614446 0.950585175552666
% -1.654120040691760 0.947984395318596
% -1.609359104781282 0.942782834850455
% -1.564598168870804 0.937581274382315
% -1.525940996948118 0.928478543563069
% -1.485249237029502 0.919375812743823
% -1.446592065106816 0.911573472041612
% -1.407934893184130 0.901170351105332
% -1.369277721261445 0.890767230169051
% -1.326551373346898 0.879063719115735
% -1.287894201424212 0.864759427828348
% -1.247202441505595 0.850455136540962
% -1.212614445574771 0.837451235370611
% -1.171922685656155 0.821846553966190
% -1.133265513733469 0.802340702210663
% -1.094608341810783 0.782834850455137
% -1.057985757884029 0.765929778933680
% -1.019328585961343 0.747724317295189
% -0.980671414038657 0.725617685305592
% -0.948118006103764 0.706111833550065
% -0.911495422177009 0.684005201560468
% -0.883011190233978 0.667100130039012
% -0.856561546286877 0.647594278283485
% -0.824008138351984 0.625487646293888
% -0.801627670396745 0.609882964889467
% -0.773143438453713 0.591677503250975
% -0.742624618514751 0.568270481144343
% -0.718209562563581 0.550065019505852
% -0.691759918616480 0.527958387516255
% -0.663275686673449 0.505851755526658
% -0.638860630722279 0.485045513654096
% -0.612410986775178 0.465539661898570
% -0.587995930824008 0.446033810143043
% -0.567650050864700 0.426527958387516
% -0.549338758901323 0.409622886866060
% -0.526958290946083 0.390117035110533
% -0.500508646998983 0.364109232769831
% -0.478128179043744 0.344603381014304
% -0.457782299084436 0.326397919375813
% -0.435401831129196 0.306892067620286
% -0.410986775178027 0.284785435630689
% -0.392675483214649 0.266579973992198
% -0.370295015259410 0.247074122236671
% -0.345879959308240 0.224967490247074
% -0.323499491353001 0.202860858257477
% -0.299084435401831 0.183355006501951
% -0.276703967446592 0.161248374512354
% -0.248219735503561 0.139141742522757
% -0.221770091556460 0.118335500650195
% -0.195320447609359 0.100130039011704
% -0.168870803662258 0.079323797139142
% -0.136317395727365 0.061118335500650
% -0.101729399796541 0.041612483745124
% -0.065106815869786 0.027308192457737
% -0.030518819938962 0.019505851755527
% -0.004069175991862 0.014304291287386];
% Taken from Fig 9.19 Ward, Strganac, page 206 using plot digitizer
% TPRvsDampingRatio(:,1) = 10.^TPRvsDampingRatio(:,1); % Converting linear to logarithmic
% https://in.mathworks.com/matlabcentral/answers/671533-using-grabit-with-log-scales
% Using cftool, x was taken as the Modified Transient Peak Ratio, and y was
% taken as the damping ratio, getting an 8 degree polynomial which was the
% best fit for this data.
syms x
% Curvefitting to an exponential function, in order to get even the
% negative damping ratios more normally
% General model Power2:----------------------------------------------------
% f(x) = a*x^b+c
% Coefficients (with 95% confidence bounds):
% a = -1.652 (-1.7, -1.604)
% b = 0.2102 (0.2017, 0.2188)
% c = 1.652 (1.603, 1.701)
%
% Goodness of fit:
% SSE: 0.001406
% R-square: 0.9997
% Adjusted R-square: 0.9996
% RMSE: 0.0048
a = -1.652;
b = 0.2102;
c = 1.652;
fx = a*x^b+c;
for ii = 3:(length(Data(:,1)))
HalfTimePeriods(ii) = Data(ii,1)-Data(ii-1,1);
mTPR(ii-2) = (Data(ii,2)-Data(ii-1,2))/(Data(ii-1,2)-Data(ii-2,2));
end
TPRfinal = mean(abs(mTPR));
T = 2*mean(HalfTimePeriods(3:end));
Frequency = 1/T;
DampingRatio = subs(fx,TPRfinal);
Wn = (2*pi)/(T*sqrt(1-(DampingRatio^2)));
disp("Modified Transient Peak Ratio Method------------------------------");
fprintf("Time Period (Modified Transient Peak Ratio Method): %f sec\n",T)
fprintf("Damping Ratio (Modified Transient Peak Ratio Method) : %f\n",DampingRatio);
fprintf("Natural Frequency (Modified Transient Peak Ratio Method) : %f rad/s %f Hz\n",Frequency*2*pi,Frequency);