[NA]Lab6:正交多项式拟合
来源:互联网 发布:办公软件学校 编辑:程序博客网 时间:2024/04/30 08:06
任务概述
给定函数
函数接口定义:
int OPA( double (*f)(double t), int m, double x[], double w[], double c[], double *eps );
裁判程序样例:
#include <stdio.h>#include <math.h>#define MAX_m 200#define MAX_n 5double f1(double x){ return sin(x);}double f2(double x){ return exp(x);}int OPA( double (*f)(double t), int m, double x[], double w[], double c[], double *eps );void print_results( int n, double c[], double eps){ int i; printf("%d\n", n); for (i=0; i<=n; i++) printf("%12.4e ", c[i]); printf("\n"); printf("error = %9.2e\n", eps); printf("\n");}int main(){ int m, i, n; double x[MAX_m], w[MAX_m], c[MAX_n+1], eps; m = 90; for (i=0; i<m; i++) { x[i] = 3.1415926535897932 * (double)(i+1) / 180.0; w[i] = 1.0; } eps = 0.001; n = OPA(f1, m, x, w, c, &eps); print_results(n, c, eps); m = 200; for (i=0; i<m; i++) { x[i] = 0.01*(double)i; w[i] = 1.0; } eps = 0.001; n = OPA(f2, m, x, w, c, &eps); print_results(n, c, eps); return 0;}/* Your function will be put here */
输出样例:
3 -2.5301e-03 1.0287e+00 -7.2279e-02 -1.1287e-01 error = 6.33e-054 1.0025e+00 9.6180e-01 6.2900e-01 7.0907e-03 1.1792e-01 error = 1.62e-04
算法思路
阅读全文
0 0
- [NA]Lab6:正交多项式拟合
- 正交多项式最小二乘法拟合 数学原理
- 用正交多项式做最小二乘拟合
- 用离散正交多项式求三次拟合多项式[MATLAB版本]
- lab6
- na
- NA
- NA
- ucore lab6
- ucore lab6
- lab6 mallocbNote
- 操作系统实验报告 lab6
- csapp-lab6 malloc-lab
- 拟合
- 拟合
- 拟合
- NA心得
- 数值分析-Legendre正交多项式 实现函数逼近
- Dubbo学习笔记:注册到zookeeper并实现远程调用
- 对同一个标签奇偶行设置不同的样式
- Boosting总结
- spring boot+jpa+thymeleaf 练习
- 关于手机移动端的触屏的事件的加载的方法
- [NA]Lab6:正交多项式拟合
- Unreal教学(8)——蓝图学习快速开始(Blueprints Quick Start Guide)
- java开发中的异常处理
- 醒目!!!
- 第一篇博客
- mac下Python2的matplotlib的更新【其实失败了,我认怂我用python3】
- BZOJ2002 弹飞绵羊 LCT维护size求深度
- npm start 失败的解决方法
- WebSocket给一个id发消息