How to plot and subplot butterfly?

조회 수: 36 (최근 30일)
Rebeca Gomez
Rebeca Gomez 2019년 9월 26일
편집: Rebeca Gomez 2019년 9월 26일
How to plot and subplot butterfly?

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 9월 26일
편집: KALYAN ACHARJYA 2019년 9월 26일
%Problem 1
n = 5000 ;
t = linspace(0,20*pi,n);
x = sin(t).*(exp(cos(t))-2*cos(4*t)+sin(t/12).^5)
y = cos(t).*(exp(cos(t))-2*cos(4*t)+sin(t/12).^5)
subplot(131);plot(t,x,'k');
hold on;
plot(t,y,'r-.');
title('x and y vs. t')
xlabel('t')
ylabel('x and y')
legend('x vs. t','y vs. t');
hold off;
subplot(132),plot(x,y,'r');
title('y vs. x')
xlabel('x')
ylabel('y')
%Problem 2
n = pi/32;
theta = 0:n:8*pi;
rho = (exp(sin(theta))-2*cos(4*theta)-(sin((20-pi)/24).^5))
subplot(133),polar(theta,rho,'--r')
title('Butterfly Curve')
xlabel('Theta (\theta)')

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by