Changing the axes of a polar plot
4 ビュー (過去 30 日間)
古いコメントを表示
I have a polar plot, however it does not fit on the axes given. How can I resize the axes?
t = 0:pi/100:2*pi;
r = abs((2+cos(t)).*(exp(2*1i*t)));
the = angle((2+cos(t)).*exp(2*1i*t));
polar(the,r)
[X,Y] = pol2cart(the,r); % get Cartesian coordinates
factor = 5; % sampling ratio; factor=5 means the arrow will be drawn for every 5th point on the curve
i = 1; % index into quiver array
j = factor * factor; % index into X,Y Cartesian coordinates
u = []; % array for x component of quiver vector
v = []; % array for y component of quiver vector
xt = []; % array for x position of quiver vector
yt = []; % array for y position of quiver vector
while (j+1) <= length(X)
xt(i) = X(j);
yt(i) = Y(j);
u(i) = X(j+1) - X(j);
v(i) = Y(j+1) - Y(j);
i = i + 1;
j = i*factor;
end
hold on;
quiver(xt, yt, u, v);
0 件のコメント
採用された回答
Star Strider
2015 年 12 月 24 日
One way to do that is to add a second polar plot, then make it invisible:
t = 0:pi/100:2*pi;
r = abs((2+cos(t)).*(exp(2*1i*t)));
the = angle((2+cos(t)).*exp(2*1i*t));
polar(the,r)
hi = polar(the, r*4/3); % Add Second Polar Plot
set(hi, 'Color','none') % Make Second Polar Plot Invisible
[X,Y] = pol2cart(the,r); % get Cartesian coordinates
. . . REST OF THE CODE . . .
I used a factor of 4/3 to expand the radius of the plot to 4. Change that to whatever works best for you.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!