Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Stretch peak to peak y-values to plot

1 visualización (últimos 30 días)
meihua
meihua el 6 de Oct. de 2013
Cerrada: meihua el 31 de Oct. de 2013
figure(1)
x =[0 pi/2 pi 3*pi/2 2*pi 5*pi/2 3*pi];
y = [0 1 0 -1 0 1 0];
bcs = csapi(x,y);
xx=linspace(0,3*pi,1000);
val=fnval(bcs,xx);
xbound=peakdet(val,.5);
period=val(:,xbound(1,1):xbound(2,1));
plot(period)
figure(2)
x2 =[0 pi/2-1.5 pi+1.5 3*pi/2 2*pi-1.5 5*pi/2+1.5 3*pi];
y = [0 1 0 -1 0 1 0];
bcs = csapi(x2,y);
xx=linspace(0,3*pi,1000);
val=fnval(bcs,xx);
xbound=peakdet(val,.5);
period=val(:,xbound(1,1):xbound(2,1));
plot(period)
peakdet is a useful script I found here: http://www.billauer.co.il/peakdet.html
The lengths of fig1 period=712, fig2 period=462. I want to stretch or compress one of these vectors so that they reach their peaks at the same indices=>period lengths are the same, while still keeping their shape. I tried interp1 but none of the methods plotted out the way I wanted it to. Is there some other function/trick I could try?

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by