Polar Plot with a moving marker
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Nik Sofoulis
il 4 Set 2014
Modificato: Nik Sofoulis
il 19 Set 2014
Hi to everyone
I am trying to plot Array Factor of an antenna using Polar2 function. I would like to know if there is any way to have a moving marker above the plot which it will follow the cursor of mouse. More specific i want to show the dBs of Array Factor as regards to angle. I want to draw a marker, which will be like a radius, and will be moving arround the circle (as regards to mouse) of polar plot and in a given angle it will show the dBs. It follows an image of a polar plot and the marker is with purple.
Thank you in advance!

0 Commenti
Risposta accettata
Joseph Cheng
il 4 Set 2014
Not entirely sure what you mean by move around the circle but here is an example:
function clicktest()
theta = 0:0.01:2*pi;
rho = sin(2*theta).*cos(2*theta);
figure
ax(1) = polar(theta,rho,'--r');
hold on
ax(2) = polar(NaN,NaN,'g*');
set (gcf, 'WindowButtonMotionFcn', {@mouseMove,ax});
function mouseMove(object, eventdata,ax)
C = get (gca, 'CurrentPoint');
[theta rho] = cart2pol(C(1,1), C(1,2));
title(gca, ['(angle,factor) = (', num2str(theta*180/pi), ', ',num2str(rho), ')']);
markerspot = sin(2*theta).*cos(2*theta);
[x y]=pol2cart(theta,markerspot);
set(ax(2),'xData',x,'yData',y,'markersize',20);
4 Commenti
Joseph Cheng
il 5 Set 2014
oh if you want to track the mouse then instead of calculating the marker spot just substitute the x and y data for C(1,1) and C(1,2). the return for mouse position is stored in C.
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


