Skip to content
Snippets Groups Projects
Verified Commit e57ca58e authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

refactor!: Change nacaairfoil and nacacamber output

The two functions now return one single matrix with both coordinates
instead of separate vectors.

Nacaairfoil can also return the data in either Selig or Lednicer
formats.
parent 4f776e8f
No related branches found
Tags v2.0.0
No related merge requests found
Pipeline #6228 passed
function [x, y] = nacaairfoil(varargin) function [coord] = nacaairfoil(varargin)
% NACAAIRFOIL Generates the full coordinates of a NACA 4 or 5 digits airfoil. % NACAAIRFOIL Generates the full coordinates of a NACA 4 or 5 digits airfoil.
% By default, the airfoil is generated with 100 points distributed following a half-cosine % By default, the airfoil is generated with 100 points distributed following a half-cosine
% rule in order to be finer at the leading and trailing edges. The default output has a zero % rule in order to be finer at the leading and trailing edges. The default output has a zero
...@@ -16,13 +16,13 @@ function [x, y] = nacaairfoil(varargin) ...@@ -16,13 +16,13 @@ function [x, y] = nacaairfoil(varargin)
% ----- % -----
% %
% Usage: % Usage:
% [X, Y] = NACAAIRFOIL prompts the user for the airfoil denomination, then determines its % [COORD] = NACAAIRFOIL prompts the user for the airfoil denomination, then determines its
% coordinates. % coordinates.
% %
% [X, Y] = NACAAIRFOIL(DIGITS) determines the coordinates of the airfoil using the airfoil % [COORD] = NACAAIRFOIL(DIGITS) determines the coordinates of the airfoil using the airfoil
% denomination given by DIGITS. % denomination given by DIGITS.
% %
% [X, Y] = NACAAIRFOIL(DIGITS, NPOINTS) determines the NPOINTS coordinates of the airfoil % [COORD] = NACAAIRFOIL(DIGITS, NPOINTS) determines the NPOINTS coordinates of the airfoil
% named after DIGITS. % named after DIGITS.
% %
% [...] = NACAAIRFOIL(..., 'spacing', SP) uses the defined spacing rule to determine to % [...] = NACAAIRFOIL(..., 'spacing', SP) uses the defined spacing rule to determine to
...@@ -44,10 +44,10 @@ function [x, y] = nacaairfoil(varargin) ...@@ -44,10 +44,10 @@ function [x, y] = nacaairfoil(varargin)
% nPoints : Number of output coordinates % nPoints : Number of output coordinates
% %
% Output: % Output:
% [X, Y] : Airfoil coordinates, with 0 <= X <= 1. % coord : Airfoil coordinates, with 0 <= X <= 1.
% The output coordinates follow the most usual order. They start at the trailing % The output coordinates follow _Selig_ order. They start at the trailing
% edge, along the upper surface to the leading edge and back around the lower surface % edge, along the upper surface to the leading edge and back around the lower surface
% to trailing edge. % to trailing edge.
% %
% Example: % Example:
% NACAAIRFOIL % NACAAIRFOIL
...@@ -55,6 +55,8 @@ function [x, y] = nacaairfoil(varargin) ...@@ -55,6 +55,8 @@ function [x, y] = nacaairfoil(varargin)
% NACAAIRFOIL('24012', 120) % NACAAIRFOIL('24012', 120)
% NACAAIRFOIL('24012', 120, 'spacing', 'halfcosine') % NACAAIRFOIL('24012', 120, 'spacing', 'halfcosine')
% NACAAIRFOIL('24012', 120, 'zerote', true) % NACAAIRFOIL('24012', 120, 'zerote', true)
% NACAAIRFOIL('24012', 120, 'savedat', true)
% NACAAIRFOIL('24012', 120, 'outputFormat', 'Lednicer')
% %
% See also: NACACAMBER. % See also: NACACAMBER.
% %
...@@ -73,22 +75,22 @@ function [x, y] = nacaairfoil(varargin) ...@@ -73,22 +75,22 @@ function [x, y] = nacaairfoil(varargin)
import af_tools.nacacamber import af_tools.nacacamber
import af_tools.utils.* import af_tools.utils.*
OPTION_LIST = {'spacing', 'zerote', 'savedat'}; OPTION_LIST = {'spacing', 'zerote', 'savedat', 'outputFormat'};
% Extract and validate the inputs % Extract and validate the inputs
[digits, nPoints, idxOpts] = parsenacainputs(OPTION_LIST, varargin{:}); [digits, nPoints, idxOpts] = parsenacainputs(OPTION_LIST, varargin{:});
[spacing, zerote, savedat] = parseoptioninputs(varargin{idxOpts:end}); [spacing, zerote, savedat, outputFormat] = parseoptioninputs(varargin{idxOpts:end});
% ------------------------------------------- % -------------------------------------------
% Coordinates calculation % Coordinates calculation
% Get camberline (we use ceil((nPoints+1)/2) to ensure the airfoil has the same number of points % Get camberline (we use ceil((nPoints+1)/2) to ensure the airfoil has the same number of points
% on the upper and lower surfaces. % on the upper and lower surfaces.
[xc, yc, gradY] = nacacamber(digits, ceil((nPoints + 1) / 2), 'spacing', spacing); [coord, gradY] = nacacamber(digits, ceil((nPoints + 1) / 2), 'spacing', spacing);
% Flip camberline, so the first element is the trailing edge % Flip camberline, so the first element is the trailing edge
xc = fliplr(xc); xc = fliplr(coord(:, 1));
yc = fliplr(yc); yc = fliplr(coord(:, 2));
% Thickness value (checks were done in nacacamber) % Thickness value (checks were done in nacacamber)
t = str2double(digits(end - 1:end)) / 100; t = str2double(digits(end - 1:end)) / 100;
...@@ -108,27 +110,31 @@ function [x, y] = nacaairfoil(varargin) ...@@ -108,27 +110,31 @@ function [x, y] = nacaairfoil(varargin)
yt = t / 0.2 * (a0 * xc.^0.5 + a1 * xc + a2 * xc.^2 + a3 * xc.^3 + a4 * xc.^4); yt = t / 0.2 * (a0 * xc.^0.5 + a1 * xc + a2 * xc.^2 + a3 * xc.^3 + a4 * xc.^4);
% Upper and lower surface coordinates % Upper and lower surface coordinates
theta = atan(gradY); theta = vecttocol(atan(gradY));
xu = xc - yt .* sin(theta); xu = vecttocol(xc - yt .* sin(theta));
yu = yc + yt .* cos(theta); yu = vecttocol(yc + yt .* cos(theta));
xl = xc + yt .* sin(theta); xl = vecttocol(xc + yt .* sin(theta));
yl = yc - yt .* cos(theta); yl = vecttocol(yc - yt .* cos(theta));
% Full coordinates % Fromats according to desired output
x = [xu, fliplr(xl(1:end - 1))]; switch outputFormat
y = [yu, fliplr(yl(1:end - 1))]; case 'Selig'
[coord, array] = selig([xu, yu], [xl, yl]);
case 'Lednicer'
[coord, array] = lednicer([xu, yu], [xl, yl]);
end
% Save coordinates to dat file % Save coordinates to dat file
if savedat if savedat
header = ['NACA', digits, ' - ', spacing, ' spacing']; header = ['NACA', digits, ' - ', spacing, ' spacing'];
filename = ['naca', digits, '.dat']; filename = ['naca', digits, '-', outputFormat, '.dat'];
savetodat(filename, header, x, y); savetodat(filename, header, array);
end end
end end
% -------------------------------------------------------------------------------------------------- % --------------------------------------------------------------------------------------------------
function [spacing, zerote, savedat] = parseoptioninputs(varargin) function [spacing, zerote, savedat, outputFormat] = parseoptioninputs(varargin)
% PARSEOPTIONINPUTS Parses the options and checks their validity % PARSEOPTIONINPUTS Parses the options and checks their validity
import af_tools.utils.* import af_tools.utils.*
...@@ -138,19 +144,24 @@ function [spacing, zerote, savedat] = parseoptioninputs(varargin) ...@@ -138,19 +144,24 @@ function [spacing, zerote, savedat] = parseoptioninputs(varargin)
DEFAULT_ZEROTE = true; DEFAULT_ZEROTE = true;
DEFAULT_SAVEDAT = false; DEFAULT_SAVEDAT = false;
ALLOWED_SPACING = {'linear', 'cosine', 'halfcosine'}; ALLOWED_SPACING = {'linear', 'cosine', 'halfcosine'};
DEFAULT_FORMAT = 'Selig';
ALLOWED_FORMATS = {'Selig', 'Lednicer'};
% Option validator % Option validator
validLogical = @(x) validateattributes(x, {'logical'}, {'scalar'}, mfilename()); validLogical = @(x) validateattributes(x, {'logical'}, {'scalar'}, mfilename());
validSpacing = @(x) any(validatestring(x, ALLOWED_SPACING, mfilename())); validSpacing = @(x) any(validatestring(x, ALLOWED_SPACING, mfilename()));
validFormat = @(x) any(validatestring(x, ALLOWED_FORMATS, mfilename()));
% Parse options % Parse options
p = inputParser; p = inputParser;
addParameter(p, 'spacing', DEFAULT_SPACING, validSpacing); addParameter(p, 'spacing', DEFAULT_SPACING, validSpacing);
addParameter(p, 'zerote', DEFAULT_ZEROTE, validLogical); addParameter(p, 'zerote', DEFAULT_ZEROTE, validLogical);
addParameter(p, 'savedat', DEFAULT_SAVEDAT, validLogical); addParameter(p, 'savedat', DEFAULT_SAVEDAT, validLogical);
addParameter(p, 'outputFormat', DEFAULT_FORMAT, validFormat);
parse(p, varargin{:}); parse(p, varargin{:});
spacing = p.Results.spacing; spacing = p.Results.spacing;
zerote = p.Results.zerote; zerote = p.Results.zerote;
savedat = p.Results.savedat; savedat = p.Results.savedat;
outputFormat = p.Results.outputFormat;
end end
function [xc, yc, gradY] = nacacamber(varargin) function [coord, gradY] = nacacamber(varargin)
% NACACAMBER Generates the coordinates of the camberline for a NACA 4 or 5 digits airfoil. % NACACAMBER Generates the coordinates of the camberline for a NACA 4 or 5 digits airfoil.
% By default, the camberline is generated with 100 points distributed following a half-cosine % By default, the camberline is generated with 100 points distributed following a half-cosine
% rule in order to be finer at the leading and trailing edges. % rule in order to be finer at the leading and trailing edges.
...@@ -53,7 +53,7 @@ function [xc, yc, gradY] = nacacamber(varargin) ...@@ -53,7 +53,7 @@ function [xc, yc, gradY] = nacacamber(varargin)
narginchk(0, 4); narginchk(0, 4);
% Import other functions from this package % Import other functions from this package
import af_tools.utils.parsenacainputs import af_tools.utils.*
OPTION_LIST = {'spacing'}; OPTION_LIST = {'spacing'};
...@@ -70,6 +70,10 @@ function [xc, yc, gradY] = nacacamber(varargin) ...@@ -70,6 +70,10 @@ function [xc, yc, gradY] = nacacamber(varargin)
[xc, yc, gradY] = camber5digits(digits, nPoints, spacing); [xc, yc, gradY] = camber5digits(digits, nPoints, spacing);
end end
xc = vecttocol(xc);
yc = vecttocol(yc);
coord = [xc, yc];
end end
% -------------------------------------------------------------------------------------------------- % --------------------------------------------------------------------------------------------------
...@@ -102,7 +106,7 @@ function [xc, yc, gradY] = camber4digits(digits, nPoints, spacing) ...@@ -102,7 +106,7 @@ function [xc, yc, gradY] = camber4digits(digits, nPoints, spacing)
% P = Position of the max camber divided by 10 % P = Position of the max camber divided by 10
% XX = Maximum thickness divided by 100 % XX = Maximum thickness divided by 100
import af_tools.utils.spacedvector import af_tools.utils.*
% Airfoil parameters % Airfoil parameters
m = str2double(digits(1)) / 100; m = str2double(digits(1)) / 100;
......
...@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
### Changed
### Deprecated
### Removed
### Fixed
## [2.0.0] - 2022-04-24
### Added
- Start using MISS_HIT for style and code analysis. - Start using MISS_HIT for style and code analysis.
- ci: Add MISS_HIT job in pipeline - ci: Add MISS_HIT job in pipeline
- ci: Add pre-commit hook for miss_hit - ci: Add pre-commit hook for miss_hit
...@@ -16,8 +28,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -16,8 +28,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- **BREAKING**: Renamed **uiuccleaner** in **formatairfoilcoord** - **BREAKING**: Renamed **uiuccleaner** in **formatairfoilcoord**
- **BREAKING**: Changed output format for **nacacamber** and **nacaairfoil**
- Feat: Add possibility to select output style for **formatairfoilcoord** - Feat: Add possibility to select output style for **formatairfoilcoord**
- Feat: Add Selig and Lednicer utils for airfoil formatting - Feat: Add Selig and Lednicer utils for airfoil formatting
- Feat: Add option to select output format for **nacaairfoil**
- Style: Adopt style from MISS_HIT - Style: Adopt style from MISS_HIT
- Copyright notice: change main copyright holder to the University - Copyright notice: change main copyright holder to the University
- Doc: Revamp `CONTRIBUTING.md` to put emphasis on MISS_HIT and conventions - Doc: Revamp `CONTRIBUTING.md` to put emphasis on MISS_HIT and conventions
...@@ -25,12 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -25,12 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactor: Rename lift, drag and moment coefficient variables to avoid conflict - Refactor: Rename lift, drag and moment coefficient variables to avoid conflict
with `cd` command. with `cd` command.
### Deprecated
### Removed
### Fixed
## [1.2.0] - 2022-04-10 ## [1.2.0] - 2022-04-10
### Added ### Added
...@@ -63,7 +73,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -63,7 +73,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Initial release - Initial release
[Unreleased]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.2.0...master [Unreleased]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v2.0.0...master
[2.0.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.2.0...v2.0.0
[1.2.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.1.0...v1.2.0 [1.2.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.1.0...v1.2.0
[1.1.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.0.0...v1.1.0 [1.1.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.0.0...v1.1.0
[1.0.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/releases/v1.0.0 [1.0.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/releases/v1.0.0
...@@ -167,9 +167,9 @@ points for each surface. ...@@ -167,9 +167,9 @@ points for each surface.
```matlab ```matlab
import af_tools.xf2mat import af_tools.xf2mat
Polar = uiuccleaner Af = formatairfoilcoord
Polar = uiuccleaner(inputDir, inputFiles, 'autosave', true) Af = formatairfoilcoord(inputDir, inputFiles, 'autosave', true)
Polar = uiuccleaner(inputDir, inputFiles, 'overwrite', true) Af = formatairfoilcoord(inputDir, inputFiles, 'overwrite', true)
``` ```
| Input | Example | Default | | Input | Example | Default |
...@@ -198,10 +198,10 @@ The output is ordered from the leading edge to the trailing edge. ...@@ -198,10 +198,10 @@ The output is ordered from the leading edge to the trailing edge.
```matlab ```matlab
import af_tools.nacacamber import af_tools.nacacamber
[xc, yc, gradY] = nacacamber [coord, gradY] = nacacamber
[xc, yc, gradY] = nacacamber(digits) [coord, gradY] = nacacamber(digits)
[xc, yc, gradY] = nacacamber(digits, nPoints) [coord, gradY] = nacacamber(digits, nPoints)
[xc, yc, gradY] = nacacamber(digits, nPoints, 'spacing', 'halfcosine') [coord, gradY] = nacacamber(digits, nPoints, 'spacing', 'halfcosine')
``` ```
| Options | Example | Default | | Options | Example | Default |
...@@ -217,11 +217,11 @@ surface to trailing edge. ...@@ -217,11 +217,11 @@ surface to trailing edge.
```matlab ```matlab
import af_tools.nacaairfoil import af_tools.nacaairfoil
[x, y] = nacaairfoil [coord] = nacaairfoil
[x, y] = nacaairfoil(digits) [coord] = nacaairfoil(digits)
[x, y] = nacaairfoil(digits, nPoints) [coord] = nacaairfoil(digits, nPoints)
[x, y] = nacaairfoil(digits, nPoints, 'spacing', spacing, 'zerote', true) [coord] = nacaairfoil(digits, nPoints, 'spacing', spacing, 'zerote', true)
[x, y] = nacaairfoil(digits, nPoints, 'savedat', true) [coord] = nacaairfoil(digits, nPoints, 'savedat', true)
``` ```
| Options | Example | Default | | Options | Example | Default |
......
...@@ -170,19 +170,15 @@ function test_correctNbCoordinates(testCase) ...@@ -170,19 +170,15 @@ function test_correctNbCoordinates(testCase)
evenNPoints = 240; evenNPoints = 240;
oddNPoints = 241; oddNPoints = 241;
[xc4even, yc4even] = af_tools.nacaairfoil('0012', evenNPoints); [coord4even] = af_tools.nacaairfoil('0012', evenNPoints);
[xc5even, yc5even] = af_tools.nacaairfoil('24012', evenNPoints); [coord5even] = af_tools.nacaairfoil('24012', evenNPoints);
[xc4odd, yc4odd] = af_tools.nacaairfoil('0012', oddNPoints); [coord4odd] = af_tools.nacaairfoil('0012', oddNPoints);
[xc5odd, yc5odd] = af_tools.nacaairfoil('24012', oddNPoints); [coord5odd] = af_tools.nacaairfoil('24012', oddNPoints);
verifyEqual(testCase, length(xc4even), evenNPoints + 1); verifyEqual(testCase, size(coord4even, 1), evenNPoints + 1);
verifyEqual(testCase, length(yc4even), evenNPoints + 1); verifyEqual(testCase, size(coord5even, 1), evenNPoints + 1);
verifyEqual(testCase, length(xc5even), evenNPoints + 1); verifyEqual(testCase, size(coord4odd, 1), oddNPoints);
verifyEqual(testCase, length(yc5even), evenNPoints + 1); verifyEqual(testCase, size(coord5odd, 1), oddNPoints);
verifyEqual(testCase, length(xc4odd), oddNPoints);
verifyEqual(testCase, length(yc4odd), oddNPoints);
verifyEqual(testCase, length(xc5odd), oddNPoints);
verifyEqual(testCase, length(yc5odd), oddNPoints);
end end
...@@ -197,17 +193,17 @@ function test_correctSpacing(testCase) ...@@ -197,17 +193,17 @@ function test_correctSpacing(testCase)
betacos = linspace(0, pi / 2, ceil((nPoints + 1) / 2)); betacos = linspace(0, pi / 2, ceil((nPoints + 1) / 2));
cosine = 1 - cos(betacos); cosine = 1 - cos(betacos);
[xc_lin, ~] = af_tools.nacaairfoil('0012', nPoints, 'spacing', 'linear'); [coord_lin] = af_tools.nacaairfoil('0012', nPoints, 'spacing', 'linear');
[xc_cos, ~] = af_tools.nacaairfoil('0012', nPoints, 'spacing', 'cosine'); [coord_cos] = af_tools.nacaairfoil('0012', nPoints, 'spacing', 'cosine');
[xc_half, ~] = af_tools.nacaairfoil('0012', nPoints, 'spacing', 'halfcosine'); [coord_half] = af_tools.nacaairfoil('0012', nPoints, 'spacing', 'halfcosine');
% Test the two halves of the output vector (i.e. upper and lower surfaces) % Test the two halves of the output vector (i.e. upper and lower surfaces)
verifyEqual(testCase, xc_lin(1:(end + 1) / 2), fliplr(linear)); verifyEqual(testCase, coord_lin(1:(end + 1) / 2, 1), fliplr(linear)');
verifyEqual(testCase, xc_cos(1:(end + 1) / 2), fliplr(cosine)); verifyEqual(testCase, coord_cos(1:(end + 1) / 2, 1), fliplr(cosine)');
verifyEqual(testCase, xc_half(1:(end + 1) / 2), fliplr(halfcos)); verifyEqual(testCase, coord_half(1:(end + 1) / 2, 1), fliplr(halfcos)');
verifyEqual(testCase, xc_lin(end:-1:(end + 1) / 2), fliplr(linear)); verifyEqual(testCase, coord_lin(end:-1:(end + 1) / 2, 1), fliplr(linear)');
verifyEqual(testCase, xc_cos(end:-1:(end + 1) / 2), fliplr(cosine)); verifyEqual(testCase, coord_cos(end:-1:(end + 1) / 2, 1), fliplr(cosine)');
verifyEqual(testCase, xc_half(end:-1:(end + 1) / 2), fliplr(halfcos)); verifyEqual(testCase, coord_half(end:-1:(end + 1) / 2, 1), fliplr(halfcos)');
end end
...@@ -218,10 +214,9 @@ function test_correctDefaults(testCase) ...@@ -218,10 +214,9 @@ function test_correctDefaults(testCase)
DEF_SPACING = 'halfcosine'; DEF_SPACING = 'halfcosine';
DEF_ZEROTE = true; DEF_ZEROTE = true;
[xc, yc] = af_tools.nacaairfoil('0012'); [coord] = af_tools.nacaairfoil('0012');
[xc_def, yc_def] = af_tools.nacaairfoil('0012', DEF_NPOINTS, 'spacing', DEF_SPACING, 'zerote', DEF_ZEROTE); [coord_def] = af_tools.nacaairfoil('0012', DEF_NPOINTS, 'spacing', DEF_SPACING, 'zerote', DEF_ZEROTE);
verifyEqual(testCase, xc, xc_def); verifyEqual(testCase, coord, coord_def);
verifyEqual(testCase, yc, yc_def);
end end
...@@ -182,13 +182,13 @@ function test_correctSpacing(testCase) ...@@ -182,13 +182,13 @@ function test_correctSpacing(testCase)
betacos = linspace(0, pi / 2, nPoints); betacos = linspace(0, pi / 2, nPoints);
cosine = 1 - cos(betacos); cosine = 1 - cos(betacos);
[xc_lin, ~] = af_tools.nacacamber('0012', nPoints, 'spacing', 'linear'); [coord_lin] = af_tools.nacacamber('0012', nPoints, 'spacing', 'linear');
[xc_cos, ~] = af_tools.nacacamber('0012', nPoints, 'spacing', 'cosine'); [coord_cos] = af_tools.nacacamber('0012', nPoints, 'spacing', 'cosine');
[xc_half, ~] = af_tools.nacacamber('0012', nPoints, 'spacing', 'halfcosine'); [coord_half] = af_tools.nacacamber('0012', nPoints, 'spacing', 'halfcosine');
verifyEqual(testCase, xc_lin, linear); verifyEqual(testCase, coord_lin(:, 1), linear');
verifyEqual(testCase, xc_cos, cosine); verifyEqual(testCase, coord_cos(:, 1), cosine');
verifyEqual(testCase, xc_half, halfcos); verifyEqual(testCase, coord_half(:, 1), halfcos');
end end
...@@ -218,18 +218,18 @@ function test_correctMaxCamber(testCase) ...@@ -218,18 +218,18 @@ function test_correctMaxCamber(testCase)
maxCambPos5 = 0.2; maxCambPos5 = 0.2;
% Calculate camberline % Calculate camberline
[xc4, yc4] = af_tools.nacacamber(naca4, 100000, 'spacing', 'linear'); [coord4] = af_tools.nacacamber(naca4, 100000, 'spacing', 'linear');
[xc5, yc5] = af_tools.nacacamber(naca5, 100000, 'spacing', 'linear'); [coord5] = af_tools.nacacamber(naca5, 100000, 'spacing', 'linear');
% Get max camber value and position from camberline coordinates % Get max camber value and position from camberline coordinates
[maxVal4, maxPos4] = max(yc4); [maxVal4, maxPos4] = max(coord4(:, 2));
[~, maxPos5] = max(yc5); [~, maxPos5] = max(coord5(:, 2));
% Naca 4 % Naca 4
verifyEqual(testCase, maxVal4, maxCambVal4, 'RelTol', 1e-3); verifyEqual(testCase, maxVal4, maxCambVal4, 'RelTol', 1e-3);
verifyEqual(testCase, xc4(maxPos4), maxCambPos4, 'RelTol', 1e-3); verifyEqual(testCase, coord4(maxPos4, 1), maxCambPos4, 'RelTol', 1e-3);
% Naca 5 % Naca 5
verifyEqual(testCase, xc5(maxPos5), maxCambPos5, 'RelTol', 1e-3); verifyEqual(testCase, coord5(maxPos5, 1), maxCambPos5, 'RelTol', 1e-3);
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment