Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Stretch peak to peak y-values to plot

1 回表示 (過去 30 日間)
meihua
meihua 2013 年 10 月 6 日
閉鎖済み: meihua 2013 年 10 月 31 日
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?

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by