How can I increase the points number in a specific region of my plot?
Afficher commentaires plus anciens
Hello, I am trying to plot an airfoil (the x-coordinate goes from 0 to 1) and in particular I need to zoom the leading edge (the forward zone of the airfoil, from the 0 coordinate to 0.1). My procedure is: 1) import data (x and y coordinates) 2) generate a dense mesh (1000 points) from 0 to 0.1 (I used the linspace command) 3) use the spline command (I also tried with interp1 command) to calculate the 1000 y-coordinates 4) plot with the LineSmoothing option but the result is very rough.
Is it possible to plot my airfoil from 0-coordinate to 0.1-coordinate but increasing the points between 0 and 0.01, for example?
Réponses (2)
Star Strider
le 1 Oct 2015
I’m not quite certain what you want, but experiment with using the logspace instead of linspace to get increased point density at the leading edge, for example:
x = logspace(-6, 0, 1000);
This begins at 1E-6 and goes to 1 (the first two arguments are base 10 exponents), and generates a 1000-element vector of logarithmically-spaced points. Experiment to get the result you want.
1 commentaire
Star Strider
le 2 Oct 2015
Since log(0) is undefined (it’s -Inf), the only suggestion I have is to lower the first argument to logspace as much as possible, perhaps to -12 or so, increase the number of elements requested to perhaps 5000 (be careful, since long vectors can cause memory problems), and see if that improves the resolution.
You could also concatenate vectors created by linspace or logspace, for instance:
v = [logspace(-12, -3, 4000), logspace(-3, 0, 1000)];
This might give you the resolution you need. Experiment to get the best result.
Alessandro Perez
le 1 Oct 2015
0 votes
Catégories
En savoir plus sur Airfoil tools dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
