Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Skyward
Matlab dependencies
Common
Commits
7381b22c
Commit
7381b22c
authored
1 month ago
by
Lucrezia Roncelli
Browse files
Options
Downloads
Patches
Plain Diff
Aggiunto file coefficientToCsv
parent
344104d2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
utilities/coefficientToCvs.m
+102
-0
102 additions, 0 deletions
utilities/coefficientToCvs.m
with
102 additions
and
0 deletions
utilities/coefficientToCvs.m
0 → 100644
+
102
−
0
View file @
7381b22c
close
;
clear
;
clc
;
%% Imposta il razzo e importa i coefficienti aerodinamici
r
=
Rocket
(
Mission
(
true
));
coefficient
=
r
.
coefficients
;
% Dati geometrici fissi
airbrakeI
=
1
;
% [-]
xcgI
=
1
;
% [m]
lRef
=
(
coefficient
.
geometry
.
chord1
+
coefficient
.
geometry
.
chord2
)
/
2
;
% Corda media [m]
P
=
[
0
1
0
;
0
0
-
1
;
-
1
0
0
];
% Preallocazione lunghezze
numAlphas
=
length
(
coefficient
.
state
.
alphas
);
numMachs
=
length
(
coefficient
.
state
.
machs
);
numBetas
=
length
(
coefficient
.
state
.
betas
);
numAltitudes
=
length
(
coefficient
.
state
.
altitudes
);
N
=
numAlphas
*
numMachs
*
numBetas
*
numAltitudes
;
% 45980
% Preallocazione tabelle per salvare i risultati: [alpha, beta, mach, Re, coefficiente]
dataCQ
=
zeros
(
N
,
5
);
dataCL
=
zeros
(
N
,
5
);
dataCD
=
zeros
(
N
,
5
);
dataCm
=
zeros
(
N
,
5
);
dataCn
=
zeros
(
N
,
5
);
dataCr
=
zeros
(
N
,
5
);
% Ciclo annidato su tutti gli stati aerodinamici
idx
=
1
;
tic
;
for
i
=
1
:
numAlphas
alpha
=
coefficient
.
state
.
alphas
(
i
)
*
pi
/
180
;
% [rad]
M1
=
[
1
0
0
;
0
cos
(
alpha
)
sin
(
alpha
);
0
-
sin
(
alpha
)
cos
(
alpha
)];
for
j
=
1
:
numMachs
mach
=
coefficient
.
state
.
machs
(
j
);
% [-]
for
k
=
1
:
numBetas
beta
=
coefficient
.
state
.
betas
(
k
)
*
pi
/
180
;
% [rad]
M2
=
[
cos
(
beta
)
0
sin
(
beta
);
0
1
0
;
-
sin
(
beta
)
0
cos
(
beta
)];
for
h
=
1
:
numAltitudes
alt
=
coefficient
.
state
.
altitudes
(
h
);
% [m]
% Estrae i coefficienti aerodinamici in quella configurazione
coefficientForce
=
coefficient
.
static
(
1
:
3
,
i
,
j
,
k
,
h
,
airbrakeI
,
xcgI
);
coefficientMoment
=
coefficient
.
static
(
4
:
6
,
i
,
j
,
k
,
h
,
airbrakeI
,
xcgI
);
% Forze trasformate nel sistema corpo
L
=
((
M1
*
M2
)\
eye
(
3
))
*
P
*
coefficientForce
;
L
([
2
,
3
])
=
-
L
([
2
,
3
]);
% Momenti trasformati nel sistema corpo
M
=
((
M1
*
M2
)\
eye
(
3
))
*
P
*
coefficientMoment
;
M
([
2
,
3
])
=
-
M
([
2
,
3
]);
% Coefficenti finali
cQ
=
L
(
1
);
% Side force coefficient
cL
=
L
(
2
);
% Lift coefficient
cD
=
L
(
3
);
% Drag coefficient
cm
=
M
(
1
);
% Pitching moment coefficient
cn
=
M
(
2
);
% Yawing moment coefficient
cr
=
M
(
3
);
% Rolling moment coefficient
% Calcolo Reynolds
[
~
,
a
,
~
,
~
,
nu
,
~
]
=
atmosisa
(
alt
);
Re
=
(
mach
*
a
*
lRef
)
/
nu
;
% Salvataggio righe nei dataset
dataCQ
(
idx
,:)
=
[
alpha
,
beta
,
mach
,
Re
,
cQ
];
dataCL
(
idx
,:)
=
[
alpha
,
beta
,
mach
,
Re
,
cL
];
dataCD
(
idx
,:)
=
[
alpha
,
beta
,
mach
,
Re
,
cD
];
dataCm
(
idx
,:)
=
[
alpha
,
beta
,
mach
,
Re
,
cm
];
dataCn
(
idx
,:)
=
[
alpha
,
beta
,
mach
,
Re
,
cn
];
dataCr
(
idx
,:)
=
[
alpha
,
beta
,
mach
,
Re
,
cr
];
idx
=
idx
+
1
;
end
end
end
end
tempoCicloFor
=
toc
;
% Esportazione su file CSV
filenames
=
{
'cQ.csv'
,
'cL.csv'
,
'cD.csv'
,
'cm.csv'
,
'cn.csv'
,
'cr.csv'
};
% ATTENZIONE cr andrà rinominata manualmente in cl affinchè sia accettata da RocketPy
datasets
=
{
dataCQ
,
dataCL
,
dataCD
,
dataCm
,
dataCn
,
dataCr
};
header
=
{
'alpha'
,
'beta'
,
'mach'
,
'Reynolds'
,
'coefficient'
};
for
idx
=
1
:
numel
(
filenames
)
T
=
array2table
(
datasets
{
idx
},
'VariableNames'
,
header
);
writetable
(
T
,
filenames
{
idx
});
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment