MATLAB: Add 0.5 *0.5 degree grid on figure (country)

figure

Hey all, I was even read grid function documentation here: https://www.mathworks.com/help/matlab/ref/grid.html
But I don't know how to set 0.5 degrees * 0.5-degree grids on the country ?!
this code below although gives me grided figure but not in 0.5*0.5 degree
borders('Iran Islamic Republic of')
grid on
ax.GridLineStyle = '-';
the output is:
Capture.JPG
you can see it is not in 0.5*0.5 degree format and it's look like it is in 5 * 2 degree!
Thank you all

Best Answer

This illustrates the general approach:
x = linspace(44, 64);
y = linspace(25, 40);
t = linspace(0,2*pi);
circx = 0.25*(max(x)-min(x))*cos(t)+min(x);
circy = 0.25*(max(y)-min(y))*sin(t)+min(y);
figure
plot(circx, circy)
xt = get(gca, 'XTick');
set(gca, 'XTick',round(linspace(min(xt),max(xt),2*numel(xt)-1),1), 'XTickLabel',round(linspace(min(xt),max(xt),2*numel(xt)-1),1))
yt = get(gca, 'YTick');
set(gca, 'YTick',round(linspace(min(yt),max(yt),2*numel(yt)-1),1), 'YTickLabel',round(linspace(min(yt),max(yt),2*numel(yt)-1),1))
I do not have the map coordinates, so I cannot reproduce the plot.