rendered paste bodyx = [a,-a,-a,a,a];
y = [b,b,-b,-b,b];
r_e = sqrt(x.^2 + y.^2);
phi_e = atan2(y,x);
x_k = [-pi,0,nan,-pi/2,pi/2];
y_k = [r_0,r_0,nan,r_0,r_0];
phi_h = [atan2(b,a),atan2(-b,-a),nan,atan2(-b,a),atan2(b,-a)];
r_h = [r_0,r_0,nan,r_0,r_0];
%ellipse
[phi,r] = kegelpol('e',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi_e,r_e,'r');
hold on;
polar(phi,r);
hold off;
ueberschrift = ['Ellipse: a=',num2str(a),' ','b=',num2str(b)];
title(ueberschrift);
%hyperbel
[phi,r] = kegelpol('h',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi_e,r_e,'r');
hold on;
polar(phi_h,r_h,'g');
hold on;
polar(phi,r); %polarplot rechts
hold on;
polar(pi-phi,r); %polarplot links
hold off;
ueberschrift = ['Hyperbel: a=',num2str(a),' ','b=',num2str(b)];
title(ueberschrift);
%parabel
[phi,r] = kegelpol('p',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi,r);
hold off;
ueberschrift = ['Parabel: a=',num2str(a)];
title(ueberschrift);x = [a,-a,-a,a,a];
y = [b,b,-b,-b,b];
r_e = sqrt(x.^2 + y.^2);
phi_e = atan2(y,x);
x_k = [-pi,0,nan,-pi/2,pi/2];
y_k = [r_0,r_0,nan,r_0,r_0];
phi_h = [atan2(b,a),atan2(-b,-a),nan,atan2(-b,a),atan2(b,-a)];
r_h = [r_0,r_0,nan,r_0,r_0];
%ellipse
[phi,r] = kegelpol('e',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi_e,r_e,'r');
hold on;
polar(phi,r);
hold off;
ueberschrift = ['Ellipse: a=',num2str(a),' ','b=',num2str(b)];
title(ueberschrift);
%hyperbel
[phi,r] = kegelpol('h',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi_e,r_e,'r');
hold on;
polar(phi_h,r_h,'g');
hold on;
polar(phi,r); %polarplot rechts
hold on;
polar(pi-phi,r); %polarplot links
hold off;
ueberschrift = ['Hyperbel: a=',num2str(a),' ','b=',num2str(b)];
title(ueberschrift);
%parabel
[phi,r] = kegelpol('p',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi,r);
hold off;
ueberschrift = ['Parabel: a=',num2str(a)];
title(ueberschrift);x = [a,-a,-a,a,a];
y = [b,b,-b,-b,b];
r_e = sqrt(x.^2 + y.^2);
phi_e = atan2(y,x);
x_k = [-pi,0,nan,-pi/2,pi/2];
y_k = [r_0,r_0,nan,r_0,r_0];
phi_h = [atan2(b,a),atan2(-b,-a),nan,atan2(-b,a),atan2(b,-a)];
r_h = [r_0,r_0,nan,r_0,r_0];
%ellipse
[phi,r] = kegelpol('e',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi_e,r_e,'r');
hold on;
polar(phi,r);
hold off;
ueberschrift = ['Ellipse: a=',num2str(a),' ','b=',num2str(b)];
title(ueberschrift);
%hyperbel
[phi,r] = kegelpol('h',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi_e,r_e,'r');
hold on;
polar(phi_h,r_h,'g');
hold on;
polar(phi,r); %polarplot rechts
hold on;
polar(pi-phi,r); %polarplot links
hold off;
ueberschrift = ['Hyperbel: a=',num2str(a),' ','b=',num2str(b)];
title(ueberschrift);
%parabel
[phi,r] = kegelpol('p',n_points,a,b,r_0);
figure
polar(x_k,y_k,'r');
hold on;
polar(phi,r);
hold off;
ueberschrift = ['Parabel: a=',num2str(a)];
title(ueberschrift);