search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

[C/C++ 演算法] 純C 曲線擬合[系統估測](最小平方估測法) – jashliao部落格

[C/C++ 演算法] 純C 曲線擬合[系統估測](最小平方估測法)

 



資料來源:http://blog.pfan.cn/weiyutian/41873.html


GITHUB: https://github.com/jash-git/CPP_polynomial_Least_Squares



#include 

#include 
#include 
#define N 5//N個點    輸入的X和Y的筆數
#define T 3 //T次擬合 設定轉移函數的階數
#define W 1//權函數
#define PRECISION 0.00001
//資料來源 http://blog.pfan.cn/weiyutian/41873.html

using namespace std;

float pow_n(float a,int n)//a^n a的n次方
{
    int i;
    if(n==0)
    {
        return(1);
    }

    float res=a;
    for(i=1;i=0;i--)
    {
        temp=argu[i][n];
        for(j=n-1;j>i;j--)
        {
            temp-=argu[i][j]*root[j];
        }
        root[i]=temp/argu[i][i];
    }
}

void get_y(float trans_A[][N],float x_y[][2],float y[],int n)
{
    int i,j;
    float temp;
    for(i=0;i



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦