Clear Filters
Clear Filters

Interpolation of directional angle between multiple coordinates

2 views (last 30 days)
Hello,
I'm currently attempting to visualize directional trends of fibers in a piece of material by determining the prevelant fiber direction in multiple, smaller subsamples. If I have a rectangular piece of material, I determine the directional angle of the fibers in small square samples taken from each of the four corners and between each of the four corners for a total of 8 directional measurements in degrees. I would like to interpolate the directional trends in the remainder of the material based on the known values I have along the perimeter of the rectangular sample.
To do this, I began by making a matrix of zeros that matches the length and height dimentions of the material sample I have (in this case, I had rectangular sample that was 11cm x 23cm so a matrix of 11 rows by 23 columns was created). I stored the directional angle values in the matrix cells that corresponded to location from which the prevelant fiber direction was taken. For example, the top lefthand 1cm x 1cm corner sample had a prevelant fiber direction of 73.17 degrees so a value of 73.13 is stored in [1,1] of my matrix. The bottom lefthand corner had a fiber directionality of 82.19, so [11,1] = 82.19. How can I interpolate the shifts in direction between each of 8 coordinates and their corresponding directional values? The very start of my code looks like this but I'm not sure how to most efficiently progress to visualizing the shifts in direction between coordinate points:
L = 11; % Sample length in cm
W = 23; % Sample width in cm
%Enter average 1x1cm sub-sample directional value (degrees)
Sample(1,1) = 73.17
Sample(1,11) = 63.84
Sample(1,23) = 11.38;
Sample(6,23) = 74.44;
Sample(11,23) = 53.94;
Sample(11,11) = 86.86;
Sample(11,1) = 82.19;
Sample(6,1) = 64.53;
This creates a matrix where the location and value of fiber direction is known at 8 points. I'd like to interpolate the values between all of these points to create a "map" of "laylines" of fiber directionality. Any advice would be very greatly appreciated!

Answers (1)

Andrew Ouellette
Andrew Ouellette on 10 Nov 2022
Hello,
You can perform 2D interpolation by using the interp2 function:
The only thing you still need to pick is a data value for the middle of your grid. Since your data is two dimensional, it is unclear to the algorithm how the data outside the perimeter should be interpolated otherwise.
xData = [1 6 11];
yData = [1 11 23];
valueData = [73.17 63.84 11.38;64.53 NaN 74.44;82.19 86.86 53.94];
valueData(2) = MISSINGDATA %could use mean([63.84 74.44 86.86 64.53]) for instance
xQuery = 1:11;
yQuery = (1:23)';
interpMatrix = interp2(xData,yData,valueData,xQuery,yQuery);

Categories

Find more on Discrete Data Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!