how to INTERPOLATE starting from three circles
2 ビュー (過去 30 日間)
古いコメントを表示
ELISABETTA BILLOTTA
2021 年 8 月 21 日
コメント済み: Image Analyst
2021 年 8 月 22 日
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 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!