Can we rotate the plot(x, y)

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 MATLAB Parallel Server 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by