plot - MATLAB Plotting Transformation -
i have set of far-field intensity data (for led / photonics application) , trying plot them via polar transformation.
the following have: 2d array of intensity values, each row corresponds specific phi, ranges 0 360 @ steps of 2; each column corresponds specific theta, ranges 0 90 @ steps of 2. results in 2d intensity array dimension of 181 46.
if manually generate phi , theta values using linspace, can plot them x values being theta, y values being phi, , intensity represented color, i've done it's quite straight forward using pcolor in matlab
in order generate polar far-field intensity plot however, x-axis needs theta/90*cos(phi), y-axis needs theta/90*sin(phi), color representing intensity once again.
i've created 3 dimensional array, size 181x46x3, stores calculated x , y, , intensity value each theta , phi. unable plot them using pcolor anymore no longer in uniform steps, nor sorted in anyway.
any ideas how plot them?
thanks in advance.
depending on want do, have 2 options, can scatter points or can interpolate them grid. example:
c=peaks(181); c=c(1:181,1:46); [th,phi]=meshgrid(0:2:90,0:2:360); creates sample data shape similar mention
using pcolor as
h=pcolor(th,phi,c); set(h,'edgecolor','none') you get:
now can x , y coordinates as:
x=(th./90).*cosd(phi); y=(th./90).*sind(phi); first option: scatter
you can directly plot as
scatter(x(:),y(:),30,c(:),'fill') pros:
- exact coordinates
cons :
- discontinuous plot, visible when zoom
second option: interpolate
you can use griddata interpolate these coordinates square grid in order plot using pcolor
[xv,yv]=meshgrid(-1:0.01:1); cv=griddata(x,y,c,xv,yv); h=pcolor(xv,yv,cv); set(h,'edgecolor','none') pros:
- continous plot
cons :
- not exact values, specially close center points close each other



Comments
Post a Comment