Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I would like to display an array of data with polar dependence in polar (r,phi) coordinates. The values of the data shall be color-coded. A single data point shall be represented by an area filled with the respective color. The center of the area is r_i, phi_1, the limits of the area is given by r_i +/-delta_r , phi_i +/- delta_phi. This data plot is typical for radars (PPI = plan position indicator). A example is enclosed. Any idea whether this is possible with Mathcad?
Solved! Go to Solution.
The attached file should do what you asked for.
As you did not provide some sample data I assumed a n x 3 data matrix (columns would be r, phi and positive color values) and created some random data to play with.
You may chose to try different colormaps or create your own to fit your needs. Furthermore you may uncheck "Auto Contour" on the "Special" tab of the 3-D plot Format box and try different values for "Number" according to the maximal number of colors in your plot.
Changing the colormap may make it necessary to change the color of the X-Y backplabe to match the color which is associated with height 0 as this is assumed to be the background (no data).
Frank Gekat wrote:
I would like to display an array of data with polar dependence in polar (r,phi) coordinates. The values of the data shall be color-coded. A single data point shall be represented by an area filled with the respective color. The center of the area is r_i, phi_1, the limits of the area is given by r_i +/-delta_r , phi_i +/- delta_phi. This data plot is typical for radars (PPI = plan position indicator). A example is enclosed. Any idea whether this is possible with Mathcad?
Yes. I have an idea of whether this is possible!
Next question? ...
Stuart
OK, literal interpretation mode aside (I've spent all day doing it!!), then I can think of at least one way, that is quite involved, and I've got another idea which I've got to have a play around with but I'm not sure it will work.
The 'involved' way involves creating a bit map of the result you want and then using the Vector Plot component to display it. The only really fiddly bit is ensuring that the 'areas' are completely and efficiently filled. However, if written in function form, then this should be reusable for any future work.
Attached is how I got it started. Maybe it will help.
Frank Gekat wrote:
I would like to display an array of data with polar dependence in polar (r,phi) coordinates. The values of the data shall be color-coded. A single data point shall be represented by an area filled with the respective color. The center of the area is r_i, phi_1, the limits of the area is given by r_i +/-delta_r , phi_i +/- delta_phi. This data plot is typical for radars (PPI = plan position indicator). A example is enclosed. Any idea whether this is possible with Mathcad?
Can you provide some sample data? In which way is the color coded (0..255 ?). Is the data equally spaced with respect to r and phi (constant delta_r and delta_phi). Basically you demand that each data point should be represented by a circular ring sector, but I guess that a quadrilateral would do the job as well, right. The way you describe it delta_r and delta_phi are half of the step intervals.
I have played around with painting routines written in Mathcad 15 to create a bitmap but my implementations of Bresenham for circles and straight lines and my floodfill were prohibitive slow so I abandoned that work. So speed could be the limiting factor in Stuarts idea.
Another idea which comes to my mind is to create a 3D mesh using the corners of the circular ring sector plus the height depending on the color and creating a contourplot. The single horizontal meshes would be connected by vertical meshes to allow for the sudden change in height and I am not sure if this would work OK.
EDIT: I tried and it works pretty well. The number of data points could be the limit, though. But I think that at least up to one million datapoints should be manageable. That number of points would result in three 2000x2000 matrices which the contour plot should take without choking.
So for example PPI data with r=0..200 and phi=0..360° and delta_r=0.5, delta_phi=0.5° (--> approx. 3*10^5 data points) should still work.
The attached file should do what you asked for.
As you did not provide some sample data I assumed a n x 3 data matrix (columns would be r, phi and positive color values) and created some random data to play with.
You may chose to try different colormaps or create your own to fit your needs. Furthermore you may uncheck "Auto Contour" on the "Special" tab of the 3-D plot Format box and try different values for "Number" according to the maximal number of colors in your plot.
Changing the colormap may make it necessary to change the color of the X-Y backplabe to match the color which is associated with height 0 as this is assumed to be the background (no data).
Werner, Fred, Stuart,
thank you very much for your quick answers and for all the work which you have invested. This is much more than I have expected.
I have noticed that all your examples are using Mathcad 15. Doesn't Prime 3.0 provide the necessary features? I am working with Mathcad since version 3.0 but I am now trying to aquaint myself with Prime.
Nice worksheet, Werner. That was one of the approaches I had in mind. I was also looking to see if I could get my 3dPlot component to accept individual polygon colouring .. they will, but I can't get the display to update. In fact, it appears that all surface colouring is disabled after I've changed the polygon colour.. I'll post that as a separate matter when I've "tidied up" the worksheet a little.
One other refinement, Frank, is using a tailored colormap - see this thread http://communities.ptc.com/message/195561#195561 for an example of how to generate and use colormaps.
Stuart