Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MechaRaptor - Data Processing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
Aerospace and Mechanical Engineering
tlambert
MechaRaptor - Data Processing
Commits
f56ae2fa
Verified
Commit
f56ae2fa
authored
2 years ago
by
Thomas Lambert
Browse files
Options
Downloads
Patches
Plain Diff
feat(figures): add save figure
parent
1e157e25
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils/plotwindonoff.m
+58
-23
58 additions, 23 deletions
utils/plotwindonoff.m
utils/save2tikz.m
+30
-0
30 additions, 0 deletions
utils/save2tikz.m
with
88 additions
and
23 deletions
utils/plotwindonoff.m
+
58
−
23
View file @
f56ae2fa
...
...
@@ -15,7 +15,11 @@ function plotwindonoff(ResData)
0.10
,
2.5
,
7.7
0.10
,
3.5
,
2.5
0.10
,
3.5
,
4.6
0.10
,
3.5
,
7.7
];
0.10
,
3.5
,
7.7
];
PLOT_TIME
=
false
;
SAVE_TIKZ_PARAM
=
INTERESTING_POINTS
(
2
,
:);
for
i
=
1
:
size
(
ResData
,
1
)
for
j
=
1
:
size
(
ResData
,
2
)
...
...
@@ -51,44 +55,54 @@ function plotwindonoff(ResData)
period
=
1
/
windOff
.
trueFreq
;
nPeriodIdx
=
period
*
sampling
;
time
=
(
0
:
length
(
meanDiff
)
-
1
)
/
nPeriodIdx
;
figure
;
hold
on
;
plot
(
time
,
meanPeakFoff
);
plot
(
time
,
meanPeakFon
);
plot
(
time
,
meanDiff
);
yyaxis
right
;
plot
(
time
,
meanPeakAngle
);
title
(
expParam
);
legend
(
'Wind off'
,
'Wind on'
,
'Diff'
);
grid
on
;
xlim
([
0
,
1
]);
if
PLOT_TIME
time
=
(
0
:
length
(
meanDiff
)
-
1
)
/
nPeriodIdx
;
figure
;
hold
on
;
plot
(
time
,
meanPeakFoff
);
plot
(
time
,
meanPeakFon
);
plot
(
time
,
meanDiff
);
yyaxis
right
;
plot
(
time
,
meanPeakAngle
);
title
(
expParam
);
legend
(
'Wind off'
,
'Wind on'
,
'Diff'
);
grid
on
;
xlim
([
0
,
1
]);
end
figure
;
ax1
=
subplot
(
3
,
1
,
1
);
hold
on
;
plot
(
meanPeakAngle
,
meanPeakFon
);
plot
(
meanPeakAngle
(
round
(
end
/
5
)),
meanPeakFon
(
round
(
end
/
5
)),
'or'
);
title
([
'Wind on - '
,
expParam
]);
%
plot(meanPeakAngle(round(end / 5)), meanPeakFon(round(end / 5)), 'or');
setgca
();
set
(
gca
,
'XTickLabel'
,
[
]);
ax2
=
subplot
(
3
,
1
,
2
);
hold
on
;
plot
(
meanPeakAngle
,
meanPeakFoff
);
plot
(
meanPeakAngle
(
round
(
end
/
5
)),
meanPeakFoff
(
round
(
end
/
5
)),
'or'
);
title
([
'Wind off - '
,
expParam
]);
%
plot(meanPeakAngle(round(end / 5)), meanPeakFoff(round(end / 5)), 'or');
setgca
();
set
(
gca
,
'XTickLabel'
,
[
]);
ax3
=
subplot
(
3
,
1
,
3
);
hold
on
;
plot
(
meanPeakAngle
,
meanDiff
);
plot
(
meanPeakAngle
(
round
(
end
/
5
)),
meanDiff
(
round
(
end
/
5
)),
'or'
);
title
([
'Diff - '
,
expParam
]);
% plot(meanPeakAngle(round(end / 5)), meanDiff(round(end / 5)), 'or');
linkaxes
([
ax1
ax2
ax3
],
'xy'
);
ax1
.
YLim
=
1.25
*
ax1
.
YLim
;
setgca
();
xlabel
(
'Flapping angle [deg]'
);
if
isinteresting
(
ResData
(
i
,
j
),
SAVE_TIKZ_PARAM
)
save2tikz
(
'figures/test.tex'
,
'\small'
);
else
title
(
ax1
,
[
'Wind on - '
,
expParam
]);
title
(
ax2
,
[
'Wind off - '
,
expParam
]);
title
(
ax3
,
[
'Diff - '
,
expParam
]);
end
end
...
...
@@ -115,3 +129,24 @@ function meanPeak = averagepeaks(signal, sampling, freq)
meanPeak
=
mean
(
peakVals
);
end
function
setgca
()
set
(
gca
,
...
'Box'
,
'off'
,
...
'TickDir'
,
'out'
,
...
'TickLength'
,
[
.
02
.
02
],
...
'XMinorTick'
,
'off'
,
...
'YMinorTick'
,
'off'
,
...
'YGrid'
,
'off'
,
...
'XGrid'
,
'off'
,
...
'XColor'
,
'k'
,
...
'YColor'
,
'k'
,
...
'GridLineStyle'
,
':'
,
...
'GridColor'
,
'k'
,
...
'GridAlpha'
,
0.25
,
...
'LineWidth'
,
1
,
...
'FontName'
,
'Helvetica'
,
...
'Fontsize'
,
14
);
ylabel
(
'\cfz [N]'
);
end
This diff is collapsed.
Click to expand it.
utils/save2tikz.m
0 → 100644
+
30
−
0
View file @
f56ae2fa
function
save2tikz
(
filename
,
tikzFontSize
)
% SAVE2TIKZ Saves the current figure to tikz.
% This function defines sane defaults to use for saving figures in Tikz format.
% Todo
% ----------------------------------------------------------------------------------------------
% (c) Copyright 2022 University of Liege
% Author: Thomas Lambert <t.lambert@uliege.be>
% ULiege - Aeroelasticity and Experimental Aerodynamics
% MIT License
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set
(
gcf
,
'PaperPositionMode'
,
'auto'
);
% Tikz options
if
nargin
<
2
tikzFontSize
=
'\normalsize'
;
end
extraTikzOptions
=
[
...
'xlabel style={font='
,
tikzFontSize
,
'},'
...
'ylabel style={font='
,
tikzFontSize
,
'},'
...
'zlabel style={font='
,
tikzFontSize
,
'}'
...
];
matlab2tikz
(
filename
,
...
'width'
,
'\fwidth'
,
...
% This allows us to edit the width in latex easily
'extraAxisOptions'
,
extraTikzOptions
,
...
'showinfo'
,
false
);
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