how to INTERPOLATE starting from three circles
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2021-8-21
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 个评论
Image Analyst
2021-8-22
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!