鱼C论坛

 找回密码
 立即注册
查看: 2509|回复: 2

求助!!!

[复制链接]
发表于 2022-11-30 10:01:51 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. static void argInit_1x11_real_T(double result[11])
  2. {
  3.         int idx1;

  4.         //循环遍历数组以初始化每个元素
  5.         for (idx1 = 0; idx1 < 11; idx1++)
  6.         {
  7.         //设置数组元素的值,将此值更改为程序所需的值
  8.                 result[idx1] = argInit_real_T();
  9.         }
  10. }

  11. static void argInit_5x1_real_T(double result[5])
  12. {
  13.         int idx0;

  14.         //循环遍历数组以初始化每个元素
  15.         for (idx0 = 0; idx0 < 5; idx0++)
  16.         {
  17.         //设置数组元素的值,将此值更改为程序所需的值
  18.                 result[idx0] = argInit_real_T();
  19.         }
  20. }


  21. static int argInit_int32_T(void)
  22. {
  23.         //double result[11];
  24.         return 0;
  25. }

  26. static double argInit_real_T(void)
  27. {
  28.         return 0.0;
  29. }


  30. static void main_Base(void)
  31. {
  32.         double dv[11] = {0,0,0,0,0.3972,0.4491,0.5389,1,1,1,1};
  33.         double ret;  
  34.        
  35.         argInit_1x11_real_T(dv);

  36.         [color=Red]ret = Base(argInit_int32_T(), dv, argInit_real_T());[/color]
  37.         [color=SeaGreen]//构造的函数:double Base(int i, const double u[11], double t);[/color]
  38. }
复制代码



想请教大家,我应该怎么改变argInit_int32_T(void)和argInit_real_T(void)这两个函数的返回值,才能使ret = Base(argInit_int32_T(), dv, argInit_real_T())不为0呢?
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-11-30 12:49:01 | 显示全部楼层
  1. Base(argInit_int32_T(), dv, argInit_real_T())
复制代码

      这个函数的定义呢?
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-11-30 14:04:29 | 显示全部楼层
jackz007 发表于 2022-11-30 12:49
这个函数的定义呢?
  1. double Base(int i,const double u[11], double t)
  2. {
  3.        
  4.         int qY;
  5.         double coeff2;
  6.         double coeff1;
  7.         double d;

  8.         isInitialized_ThreeS2 = false;
  9.         if (!isInitialized_ThreeS2)
  10.         {
  11.                 ThreeS2_initialize();
  12.         }

  13.         /* 基函数的构造 */
  14.         if (i > 2147483644)
  15.         {
  16.                 qY = MAX_int32_T;
  17.         }
  18.         else
  19.         {
  20.                 qY = i + 3;
  21.         }

  22.         coeff2 = u[i - 1];
  23.         if (u[qY - 1] - coeff2 == 0.0)
  24.         {
  25.                 coeff1 = 0.0;
  26.         }
  27.         else
  28.         {
  29.                 coeff1 = (t - coeff2) / (u[i + 2] - coeff2);
  30.         }

  31.         coeff2 = u[i + 3];
  32.         d = coeff2 - u[i];
  33.         if (d == 0.0)
  34.         {
  35.                 coeff2 = 0.0;
  36.         }
  37.         else
  38.         {
  39.                 coeff2 = (coeff2 - t) / d;
  40.         }

  41.         return coeff1 * b_Base(i, 2.0, u, t) + coeff2 * b_Base(i + 1, 2.0, u, t);
  42. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-23 01:47

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表