日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

Spline interpolation and Savitzki-Golay smoothing

發(fā)布時間:2023/11/27 生活经验 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Spline interpolation and Savitzki-Golay smoothing 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

轉(zhuǎn)自:http://octave.1599824.n4.nabble.com/Spline-interpolation-and-Savitzki-Golay-smoothing-td1675136.html

?

## natural-cubic-spline interpolation
## usage: yspline = spline(x,y,xspline)
## example:
## x = 0:10; y = sin(x);
## xspline = 0:0.1:10; yspline = spline(x,y,xspline);
## plot(x,y,"+",xspline,yspline);
## Given the vectors x and y, which tabulate a function, with
## x(1) < x(2) < x(3) <... or x(1) > x(2) > x(3) >..., and given
## the vector xspline, this function returns a natural-cubic-spline
## interpolated vector yspline.
## author: Zdenek Remes, May 22, 1999


function ynew = spline(x,y,xnew)
[x,index]=sort(x);
y=y(index);
n=length(y);
y2(1)=0.0;
y2(n)=0.0;
u(1)=0.0;
for i=2:n-1
? sig=(x(i)-x(i-1))/(x(i+1)-x(i-1));
? p=sig*y2(i-1)+2.0;
? y2(i)=(sig-1.0)/p;
? u(i)=(y(i+1)-y(i))/(x(i+1)-x(i))-(y(i)-y(i-1))/(x(i)-x(i-1));
? u(i)=(6.0*u(i)/(x(i+1)-x(i-1))-sig*u(i-1))/p;
endfor;
k=n-1;
while (k >= 1)
? y2(k)=y2(k)*y2(k+1)+u(k);
? k--;
endwhile;

i1=1; in=length(xnew);

#if (xnew(1) < x(1))
# ?error("spline: bad xspline");
#endif;
#if (xnew(in) > x(n))
# ?error("spline: bad xspline");
#endif;
?
if (xnew(1) == x(1))
? ynew(1)=y(1);
? i1=2;
endif;
if (xnew(in) == x(n))
? ynew(in)=y(n);
? in=in-1;
endif;
?

for i=i1:in ?
? khi=n;
? klo=1;
? while ((khi-klo) > 1)
? ? k=floor((khi+klo)/2);
? ? if (x(k) > xnew(i))
? ? ? khi=k;
? ? else
? ? ? klo=k; ?
? ? endif;
? endwhile;
? h=x(khi)-x(klo);
? a=(x(khi)-xnew(i))/h;
? b=(xnew(i)-x(klo))/h;
? ynew(i)=a*y(klo)+b*y(khi)+((a^3-a)*y2(klo)+(b^3-b)*y2(khi))*(h*h)/6.0;
endfor;
endfunction;

## Savitzky-Golay smoothing filter
## usage: [xsavgol,ysavgol]=savgol(x,y,nl,nr,m)
## example: x=0:0.01:3;y1=sin(x.^3);y=y1+(rand(1,301)-0.5)/3;
## ? ?[xsavgol,ysavgol]=savgol(x,y,10,10,2);
## ? ?plot(x,y,"+",xsavgol,ysavgol,x,y1)
## Given vectors x, y containing a tabulated data y=f(x) with
## equally spaced x's this function calculates smoothed data
## ysavgol=g(xsavgol) by Savitzky-Golay smoothing filter.
## nl is the number of leftward (past) data points used, while
## nr is the number of rightward (future) data points, making
## the total number of data points used nl+nr+1. m is the order
## of the smoothing polynomial, also equal to the highest
## conserved moment; usual values are m=2 or m=4.
## The idea of Savitzky-Golay filtering is to smooth the
## underlying data y=f(x) within the moving window not by a
## constant (whose estimate is the average), but by a poly-
## nomial of higher order. Thus for a point y(i) the function
## savgol fits by a least-squares method a polynomial to
## points y(i-nl), ..., y(i+nr) in the moving window, and
## then set g(i-nl+1) to the value of that polynomial at
## position x(i).
## Zdenek Remes, Mai 22, 1999
? ? ? ?
function [xnew,ynew]=savgol(x,y,nl, nr, M)
? ? if max(diff(x,2))>100*eps
? ? ? ? error("The x's must be equally spaced.")
? ? endif
? ? for i=-nl:nr
? ? ? ? for j=0:M
? ? ? ? ? ? A(i+nl+1,j+1)=i^j;
? ? ? ? endfor
? ? endfor
? ? AA=inv(A'*A);
? ? for i=-nl:nr
? ? ? ? cc=0;
? ? ? ? for m=0:M
? ? ? ? ? ? cc=cc+AA(1,m+1)*i^m;
? ? ? ? endfor
? ? c(i+nl+1)=cc;
? ? endfor
? ?
? ? nx=length(x);
? ? for i=nl:nx-nr-1
? ? ? ? yy=0;
? ? ? ? for j=-nl:nr
? ? ? ? ? ? yy=yy+c(j+nl+1)*y(i+j+1);
? ? ? ? endfor
? ? ? ? xnew(i-nl+1)=x(i+1);
? ? ? ? ynew(i-nl+1)=yy;
? ? endfor ? ?
endfunction

總結(jié)

以上是生活随笔為你收集整理的Spline interpolation and Savitzki-Golay smoothing的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

歡迎分享!

轉(zhuǎn)載請說明來源于"生活随笔",并保留原作者的名字。

本文地址:Spline interpolation and Savit

主站蜘蛛池模板: 亚洲欧美激情精品一区二区 | 香蕉视频在线看 | 久久国产欧美日韩精品 | 五月深爱网| 久久精品视频9 | 精品一区二区三区视频 | 国内精品在线观看视频 | 国产高清一区在线 | 国产观看| 欧美人与动牲交a欧美精品 欧美三级在线看 | 久久97人妻无码一区二区三区 | 欧洲亚洲一区二区 | 99精品久久久久久久婷婷 | 中文字幕av不卡 | 99精品在线 | 欧美一区二区日韩一区二区 | 秘密基地动漫在线观看免费 | www.蜜桃av| 熟妇一区二区三区 | 精品国自产拍在线观看 | 成人久久网 | 人成在线免费视频 | 久久国产二区 | 欧美精品成人一区二区在线观看 | 黄色小视频在线观看 | 中国黄色一级片 | av资源中文在线 | 国产乱人伦 | 天码人妻一区二区三区在线看 | 葵司av电影 | www嫩草 | 久久亚洲av午夜福利精品一区 | 你懂的网站在线观看 | julia一区二区 | 亚洲少妇一区二区三区 | 91全免费 | 美女校花脱精光 | 国产人成无码视频在线观看 | 午夜视频精品 | 日韩精品一区中文字幕 | 不卡日本 | 免费看美女被靠到爽的视频 | 中文字幕人妻精品一区 | 不卡av影院 | 免费a大片 | 99视频| 性农村xxxxx小树林 | 乖女从小调教h尿便器小说 欧美韩一区二区 | 亚洲精品久久久蜜桃网尤妮丝 | 久久牛牛 | 精品国产美女 | 朝鲜黄色片 | 天天干天天插天天射 | 欧美日韩国内 | 欧美两根一起进3p做受视频 | 日韩免费av片 | 大地资源二中文在线影视观看 | 一级黄色性视频 | av首页在线 | 日韩人妻无码精品久久免费 | 亚州色图欧美色图| 欧美精品黑人猛交高潮 | 人妻一区二区三区四区五区 | 在线观看免费高清 | 欧美91精品久久久久国产性生爱 | av女人的天堂 | 狠狠操操| 美女黄色免费网站 | 揄拍成人国产精品视频 | 日本一区二区三区视频在线观看 | 亚洲国产成人精品一区二区三区 | 四季av国产一区二区三区 | 三极片黄色 | 亚洲综合五月天婷婷丁香 | 日韩视频免费观看高清 | 99热99热 | 91久久精品夜夜躁日日躁欧美 | 天堂一二三区 | 中文字幕一区二区三区手机版 | 国产精品久久久久久人 | 久操精品在线 | 香蕉视频亚洲一级 | 国产熟女高潮视频 | sm在线看| 日本在线加勒比 | 精品69 | 99热一区二区 | 欧美一级做a爰片免费视频 成人激情在线观看 | 91精品国产手机 | 18久久 | 日韩色一区 | 国产女人呻吟高潮抽搐声 | 亚洲乱妇 | 亚洲精品 日韩无码 | 亚洲永久精品一区 | www.蜜臀av.com | 免费在线观看成年人视频 | 日婷婷| 131美女爱做视频 |