function [ X ] = RosesWAccelerated( Roses )
% X0Ϊ
% AΪ뾶
% KΪҶӵĸҶӵĴСڲ
% w Ϊٶ
% a ΪǼٶ
% T Ϊ۲ʱ
% TStartΪʼʱ
% TEndΪֹʱ

X0=Roses.X0;A=Roses.A;K=Roses.K;w=Roses.w;a=Roses.a;
T=Roses.T;TStart=Roses.TStart;TEnd=Roses.TEnd;alpha=Roses.Alpha;
if A==0
    X=X0.*ones(max(size(TStart+T:T:TEnd)),2);
    return;
end

b=0;
c=0;
number=(TEnd-TStart)/T;
for k=1:1:number+1
    t=(k-1)*T;
    %% ٶʱĹϵʽ
    AA(k)=a+b*t+c*t^2;
    %----------------------%
end

Angle(1)=0;
j=0;
for i=1:1:number
    angle=w*T+1/2*(AA(i+1)+AA(i))/2*T^2;
    w=w+(AA(i+1)+AA(i))/2*T;
    Angle(i+1)=Angle(i)+angle;
    j=j+1;
    theta(j)=Angle(i+1);
end
rho=A*cos(K*theta);
%[theta, r]=cart2pol(x,y) %ѿתΪ

[x,y]=pol2cart(theta+alpha, rho); %תΪѿ

x=x+X0(1,1);
y=y+X0(1,2);
X = [x' y'];
end

%õ߷̵ıͼ
%rho=a*sin(k*theta)
%rho=a*cos(k*theta)
%kΪΪʱõҶӵĸΪkΪpi
%kΪΪżʱõҶӵĸΪ2*kΪ2*pi
%kΪN/DNĸDΪʱõҶΪNΪD*piNĸDһΪżʱõҶΪ2*NΪ2*D*pi
