Can we rotate the plot(x, y)
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
CHANDRABHAN Singh
am 23 Sep. 2021
Beantwortet: Cris LaPierre
am 23 Sep. 2021
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.
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 23 Sep. 2021
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Parallel Server finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!