フィルターのクリア

Can we rotate the plot(x, y)

2 ビュー (過去 30 日間)
CHANDRABHAN Singh
CHANDRABHAN Singh 2021 年 9 月 23 日
回答済み: Cris LaPierre 2021 年 9 月 23 日
for w=0.5:0.1:1
l = w;
thet = 0:1:60;
theta = thet .*(pi/180);
c = cos(theta);
p = 4*(1-l^2).*(c.^2) + (2*l - 1)^2;
q = 2*(1-l*l).*c + (2*l-1)*sqrt(4*(1-l*l).*(c.^2) + 5 *l*l - 4*l);
r =(q./p);
thetaa = [0:60, 60:120, 120:180, 180:240, 240:300, 300:360].*(pi/180);
v = [r, fliplr(r(1:61)), r(1:61), fliplr(r(1:61)), r(1:61), fliplr(r(01:61))];
%polarplot(thetaa,v);
[x, y] = pol2cart(thetaa, v);
plot(x,y);
hold on;
end
pbaspect([1 1 1]);
grid on;
xlabel('x-axis');
ylabel('y-axis');
If we run the above code, the following plot is obtained. I want the apex to be pointed upwards (any apex of the tringle). Is it possible.

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 9 月 23 日
You could reverse your x and y inputs. Use -x to make the triangle point up.
for w=0.5:0.1:1
l = w;
thet = 0:1:60;
theta = thet .*(pi/180);
c = cos(theta);
p = 4*(1-l^2).*(c.^2) + (2*l - 1)^2;
q = 2*(1-l*l).*c + (2*l-1)*sqrt(4*(1-l*l).*(c.^2) + 5 *l*l - 4*l);
r =(q./p);
thetaa = [0:60, 60:120, 120:180, 180:240, 240:300, 300:360].*(pi/180);
v = [r, fliplr(r(1:61)), r(1:61), fliplr(r(1:61)), r(1:61), fliplr(r(01:61))];
%polarplot(thetaa,v);
[x, y] = pol2cart(thetaa, v);
% ### plot y as x and -x as y ###
plot(y,-x);
hold on;
end
pbaspect([1 1 1]);
grid on;
xlabel('x-axis');
ylabel('y-axis');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScopes and Data Logging についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by