how to INTERPOLATE starting from three circles
1 view (last 30 days)
Show older comments
ELISABETTA BILLOTTA
on 21 Aug 2021
Commented: Image Analyst
on 22 Aug 2021
Through the information of 3 distances and 3 wind speeds I was able to create circles as shown in the figure where each point that makes up the circles is characterized by X=latitude, Y=longitude of the point and Z is the probability of obtaining the speed of a given wind at that distance from the center.
Now what I would like to do is create the same graph but INTERPOLATING on the entire grid: in each point of the grid starting from values of X=3 known distances and Y= 3 known speeds and entering a distance from the point of interest (xi), I would like calculate the angle at that point with respect to the source (as I did for the three circles), then with this distance from the source I thought I would enter the graph by interpolating and see what is the speed it takes to get to that point at that distance.
I had read about the function yi = interp1q (X, Y, xi): for example I thought that to calculate the probability of the speed, I know how far I am (like 100km), I use interp1q, I calculate what minimum speed (yi) I need to reach the distance (100km) and consequently calculate the probability of having a speed higher than the minimum speed I found.
I tried to use this function but it fails. Can anyone help me?
0 Comments
Accepted Answer
Image Analyst
on 21 Aug 2021
See how they use sin and cos in the third example in the FAQ:
Basically put that code into a double loop over your Xs and Ys. Here's a start:
angles = linspace(0, 360, 1000);
for k = 1 : length(X)
xCenter = X(k);
for k2 = 1 : length(Y)
yCenter = Y(k2);
xCircle = xCenter + radius * cosd(angles)
yCircle = yCenter + radius * sind(angles)
plot(xCircle, yCircle, '-', 'LineWidth', 3);
hold on;
end
end
Write back if you still can't figure it out.
2 Comments
Image Analyst
on 22 Aug 2021
If you want markers only, and not lines connecting them, use * instead of -:
plot(xCircle, yCircle, '*', 'MarkerSize', 7);
You can adjust the number of markers by adjusting the number of angles. For example if you wanted 12 markers
angles = linspace(0, 360, 13); % One more than 12 because 0 and 360 are on top of each other.
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices 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!