horizontal translation distorts the plot

1 view (last 30 days)
I'm tryin to plot and fit the following function:
function ret = pd(aqq, center, FreqVec);
%p1: -aqq/2<f<aqq
FreqVec1 = FreqVec(find(((FreqVec-center) <= -0.5*aqq)));
p11=zeros(1,length(FreqVec1));
FreqVec2 = FreqVec(find(((FreqVec-center) < aqq) & ((FreqVec-center) > -0.5*aqq)));
p12=((0.5*aqq+(FreqVec2-center)).^(-0.5));
FreqVec3 = FreqVec(find(((FreqVec-center) > aqq)));
p13=zeros(1,length(FreqVec3));
p1=[p11 p12 p13];
%p2: -aqq>f>aqq/2
FreqVec1 = FreqVec(find(((FreqVec-center) <= -aqq)));
p21=zeros(1,length(FreqVec1));
FreqVec2 = FreqVec(find(((FreqVec-center) < 0.5*aqq) & ((FreqVec-center) > -aqq)));
p22=((0.5*aqq-(FreqVec2-center)).^(-0.5));
FreqVec3 = FreqVec(find(((FreqVec-center) >= 0.5*aqq)));
p23=zeros(1,length(FreqVec3));
p2=[p21 p22 p23];
ret= p1+p2;
end
It should be a symmetrical doublet with peaks separated by aqq, but when I allow the horizontal transition (ie. set the parameter center different than zero) the plot gets distorted: one of the peaks gets bigger, the other one gets smaller. How should I redefine this function to have a possibility to shift it along the x axis wihout losing the symmetrical shape of spectrum?

Answers (0)

Community Treasure Hunt

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

Start Hunting!