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!