function rosette_orbits(a,b,ro,rvo)

%%rosette_orbits(a,b,ro,rvo) takes four arguments at command line
%%It takes parameters a and b for diff equation r''=1/r^3-b/r^a
%%ro and rvo are r(0) and r'(0)

%%Treat F as a two dimensional vector of strings at first so a and b can
%%be substituted in at the command line
%%vector F is constructed as follows
%%F=[y(1)';y(2)'] ; where y(1)'=phi_dot, y(2)'=phi_double_dot

F='[y(2);1/y(1).^3-b/y(1).^a;1./(y(1).^2)]';
beta=num2str(b);
alpha=num2str(a);

%%Replance b with argument b; Replace a with argument a
F_with_b=regexprep(F,'b',beta);
F_with_a_b=regexprep(F_with_b,'a',alpha);

%%Declare func as an inline function
func=inline(F_with_a_b,'t','y');


[t,y]=ode45(func,[0.01,15],[ro,rvo,0]);

len=length(y(:,1));
x_pos=(y(:,1)).*cos(y(:,3));
y_pos=(y(:,1)).*sin(y(:,3));

clf reset;
hold on;
plot(x_pos(1:100),y_pos(1:100),'r');
plot(x_pos(100:len),y_pos(100:len),'b');



%%Good parameters for plots in homework
%%>> rosette_orbits(2.3,3.2,.45,.45),tf=2.7
%%>> rosette_orbits(2.1,2.5,.8,.45)
%%>> rosette_orbits(1.9,2.5,.8,.45)
