⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample6_11.cs

📁 用于矩阵的各种运算
💻 CS
字号:
/*
 * 示例程序Sample6_11: Interpolation类的光滑不等距插值
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 数据
            int n = 11;
            double[] x = {-1.0,-0.95,-0.75,-0.55,-0.3,0.0,0.2,0.45,0.6,0.8,1.0};
            double[] y = {0.0384615,0.0424403,0.06639,0.116788,0.307692,1.0,0.5,0.164948,0.1,0.0588236,0.0384615};
            double[] t = {-0.85,0.15};
		
            // 插值运算
            for (int i=0; i<t.Length; ++i)
            {
                double[] coef = new double[5];
                double yt = Interpolation.GetValueAkima(n, x, y, t[i], coef, -1);
                Console.WriteLine("f(" + t[i] + ") = " + yt);
                for (int j=0; j<coef.Length; ++j)
                    Console.WriteLine("s" + j + " = " + coef[j]);
            }		
        }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -