diff --git a/+af_tools/+utils/spacedvector.m b/+af_tools/+utils/spacedvector.m index ecf48e348549431c67a49ebcbd736d0704dbd3de..eed470dbbb476285f56210468c92a3ef3cdc7709 100644 --- a/+af_tools/+utils/spacedvector.m +++ b/+af_tools/+utils/spacedvector.m @@ -1,7 +1,14 @@ function vect = spacedvector(spacing, nPoints) % SPACEDVECTOR Returns a vector based on chosen spacing and number of points + % + % Spacing: + % - linear : points spaced linearily + % - halfcosine : more dense at beginning and end of vector + % - cosine : more dense at the beginning and more spaced out at the end + % - sine : more dense at the end and more spaced out at the beginning + % % ----- - % (c) Copyright 2022 University of Liege + % (c) Copyright 2022-2023 University of Liege % Author: Thomas Lambert <t.lambert@uliege.be> % ULiege - Aeroelasticity and Experimental Aerodynamics % Apache 2.0 License @@ -18,6 +25,9 @@ function vect = spacedvector(spacing, nPoints) case 'cosine' beta = linspace(0, pi / 2, nPoints); vect = 1 - cos(beta); + case 'sine' + beta = linspace(0, pi / 2, nPoints); + vect = sin(beta); end end diff --git a/+af_tools/nacacamber.m b/+af_tools/nacacamber.m index 94ec3b81616fa676aa041331bc10bc46326abd0f..ab13a45b06a6654c98d1ae2b06f7bd9311c266a2 100644 --- a/+af_tools/nacacamber.m +++ b/+af_tools/nacacamber.m @@ -6,13 +6,13 @@ function [coord, gradY] = nacacamber(varargin) % ----- % % Usage: - % [X, Y] = NACACAMBER prompts the user for the airfoil digits, then calculates the coordinates - % of the camberline using 100 points spaced with the half-cosine rule. + % [coord, gradY] = NACACAMBER prompts the user for the airfoil digits, then calculates the + % coordinates of the camberline using 100 points spaced with the half-cosine rule. % - % [X, Y] = NACACAMBER(DIGITS) calculates the coordinates of the camberline for the NACA - % airfoil specified by DIGITS, without further input. + % [coord, gradY] = NACACAMBER(DIGITS) calculates the coordinates of the camberline for the + % NACA airfoil specified by DIGITS, without further input. % - % [X, Y] = NACACAMBER(DIGITS, NPOINTS) calculates the coordinates of the NACA airfoil + % [coord, gradY] = NACACAMBER(DIGITS, NPOINTS) calculates the coordinates of the NACA airfoil % specified by DIGITS, using NPOINTS points spaced with the half-cosine rule. % % [...] = NACACAMBER(..., 'spacing', SP) uses the defined spacing rule to determine to @@ -20,14 +20,14 @@ function [coord, gradY] = nacacamber(varargin) % 'linear' - linear % 'halfcosine' - (default) finer at leading and trailing edges % 'cosine' - finer at leading edge, coarser at the trailing edge + % 'sine' - finer at trailing edge, coarser at the leading edge % % Inputs: % digits : Character vector representing the NACA airfoil (ex: '0012', '24120', '24012') % nPoints : Number of output coordinates % % Output: - % xc : Camberline X coordinates (0 <= X <= 1) - % yc : Camberline Y coordinates + % coord : Camberline coordinates [nPts x 2] % gradY : Gradient of Y (required to get the whole airfoil coordinates) % % Example: @@ -41,7 +41,7 @@ function [coord, gradY] = nacacamber(varargin) % <a href="https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox">Documentation (online)</a> % ------------------------------------------- - % (c) Copyright 2022 University of Liege + % (c) Copyright 2022-2023 University of Liege % Author: Thomas Lambert <t.lambert@uliege.be> % ULiege - Aeroelasticity and Experimental Aerodynamics % MIT License