Making contours in polar plot

19 visualizaciones (últimos 30 días)
Muhammad Khan
Muhammad Khan el 26 de Mzo. de 2020
Comentada: John D'Errico el 1 de Abr. de 2020
How can i connect the boundary of scatters (only maximum values) with a line? Required line is denoted with "Black Line" in below figure. Please guide me.
  2 comentarios
John D'Errico
John D'Errico el 26 de Mzo. de 2020
Editada: John D'Errico el 26 de Mzo. de 2020
Your question makes no sense.
The "contour" of points within a distance of 100 meters from the polar origin is simply a circle of radius 100. The same applies for 200, and 300. Just draw circles of the corresponding radius. Problem solved. No?
In fact, it would seem that if you drew any other shape for those contours, you would be doing something that as I said, makes no sense. The shape that has all points within a fixed distance from the origin is indeed a circle. It cannot be anything else.
Muhammad Khan
Muhammad Khan el 26 de Mzo. de 2020
Editada: Muhammad Khan el 26 de Mzo. de 2020
Dear John D'Errico I have edited the post for better readability. Actually I want to connect the boundary of scatters (only maximum values) with a line? Required line is denoted with "Black Line" in above figure. Please guide me. Thanks in advance

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 26 de Mzo. de 2020
Editada: John D'Errico el 26 de Mzo. de 2020
You could at least spell my name right, since you had it right in front of you.
Regardless, it turns out that you changed your question, wanting to do something completely different from a contour plot in polar coordiantees. (The original question was indeed about contour plots.)
You have polar form data, so as a function of angle (here, wind direction), you have a parameter called FETCH2.
Now you are asking how to create the envelope of that data in polar form. That is simply the local maximum for FETCH2, as a function of angle. I would show how to do it, except that your data is not what you plotted. In fact, the data is quite different from what your picture shows.
However, the answer will still be the same. I would simply estimate the maximal value of FETCH2 as a function of angle. Don't do that using a set of TESTS for each angular bin!!!!!!!
In fact though, your data is NOT what you show it to be. It is NOT a nice uniform thing in polar coordiantes. In fact, you have very little data between some angles.
The problem is you used polarscatter INCORRECTLY!!!!!!!!!!
Read the help! Polarscatter and polarplot both assume the angle is in radians, NOT in degrees.
Here is your data, plotted now correctly in terms of RADIANS, when converted from degrees.
polarscatter(WD1*pi/180,FETCH2)
hist(WD1,50)
So you have essentially no data measured between roughly 120 degrees and 180 degrees.
Polarscatter does not automatically infer that the data looks like it is scaled to be degrees, so use it as degrees. It should never try to be that intelligent, because you might not want that to be done. In fact, the documentation for those tools explicitly states you need to provide angular information in terms of degrees, NOT radians.
You might ask why it is that polarplot indicates the angles as degrees on the plot, when it really wants radians as input, but that would be a valid question for the person who wrote the code. It sort of makes some sense, since we usually think of a polar plot in terms of degrees, so it labels the plot in degrees. The documentation should be wildly more clear about the presumption of radians as input however. Not my problem though.
Finally, there is the problem of how to generate that envelope. Remember that you have essentially no data for wide expanses of polar angle. This is more difficult, since you have so little data for much of the polar plot. It arguably makes very little sense to try to determine what is the maximum of that relationship near 150 degrees, since you have absolutely no data in that vicinity.
  2 comentarios
Muhammad Khan
Muhammad Khan el 26 de Mzo. de 2020
Dear John D'Errico, First of all please accept my apology for typing mistake in your name. It would be much help If you could estimate for me the "maximal value of FETCH2 as a function of angle". For region with no data (near 150 degree), please calculate the maximum value between 200 meters and 300 meters and connect those maximum values with line. It would be much appreciated.
Thanking you in anticipation.
Regards
John D'Errico
John D'Errico el 1 de Abr. de 2020
I cannot estimate it, as you have no data even remotely in the vicinity. Did you delete your data? It looks like you did, but luckily my history in MATLAB allowed me to recover it.
plot(WD1,FETCH2,'.')
As I said, you have no data in the region between 120 and 180 for WD1. So, is the maximum in that region as low as the roughly 2 data points in that region? Or would you choose to pick some arbitrary higher value?
The best way to solve your problem is logically to get better data, rather than making up a number.
An alternative might be to find the maximum value of FETCH2, as a function of angle within some tolerance in angle, perhaps +/- 15 degrees. The problem is, this may leave some regions with no data at all. What is the largest hole where we find no data at all?
max(diff(sort(WD1)))
ans =
27.128
So there is one interval where no data at all is seen over a 27 degree angular span. A +/- 15 degree window (thus a window of width 30 degrees) would then be just large enough that there would always be at least one data point in any interval.

Iniciar sesión para comentar.

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by