声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2240|回复: 1

[综合讨论] 分数阶常微分方程的求解matlab程序

[复制链接]
发表于 2011-1-6 17:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
求 求解分数阶常微分方程的matlab程序代码,谢谢
回复
分享到:

使用道具 举报

发表于 2011-1-6 22:13 | 显示全部楼层
下面的程序仅作参考
  1. % This function solves linear fractional-order differential equation (fode)
  2. % with constant coefficients of the form:
  3. %
  4. %        n/v            (n-1)/v                1/v
  5. % c1(1)*D   y(t)+c1(2)*D       y(t)+...+c1(n)*D   y(t)+c1(n+1)*y(t) =
  6. %
  7. %                m/v            (m-1)/v                1/v           
  8. %         c2(1)*D   r(t)+c2(2)*D       r(t)+...+c2(m)*D   r(t)+c2(m+1)*r(t)      
  9. %
  10. %
  11. % Inputs:
  12. %
  13. %           v  : common denominator
  14. %           c1 : vector of output coefficients (1x(n+1))
  15. %           c2 : vector of input coefficients (1x(m+1))
  16. %           r  : samples of the input signal r(t)
  17. %           h  : sampling period
  18. %
  19. % Outputs:
  20. %           y  : vector of output samples
  21. %           t  : time vector (corresponding to y)
  22. %
  23. % Author: Farshad Merrikh Bayat ([email]fbayat@ee.sharif.edu[/email])
  24. % URL: http:// ee.sharif.edu/~fbayat/
  25. %
  26. % Note: this function calls the function "fderiv.m" which is also
  27. %       downloadable from MathWorks-File Exchange. The parameter "h" can
  28. %       easily be tuned; it must be as small as approximate the input signal
  29. %       r(t). The short memory principle has not neen used here, so the
  30. %       length of input signal is limited to few hundred samples.
  31. %
  32. % Copyright (c), 2007.
  33. %



  34. function [t,y] = fode2(v,c1,c2,r,h)

  35. n = length(c1)-1;
  36. % r = k*ones(1,100); % if the input signal is unit step
  37. temp1 = zeros(size(r));
  38. for i=1:length(c2)
  39.     r_new = fderiv((length(c2)-i)/v,r,h);
  40.     temp1 = temp1+c2(i)*r_new;
  41. end

  42. r = temp1;

  43. t = [0:1:length(r)-1]*h;
  44. y = zeros(1,length(r));

  45. temp = zeros(1,n);

  46. a = 0;
  47. for i=1:length(c1)
  48.     a = a+c1(i)/h^((n-i+1)/v);
  49. end

  50. for i=1:length(r)
  51.     for k=n:-1:1
  52.         for j=1:i-1
  53.             temp(n-k+1) = temp(n-k+1)+(-1)^j*gamma(k/v+1)*y(i-j)/(gamma(j+1)*gamma(k/v-j+1));
  54.         end
  55.         temp(n-k+1) = -c1(n-k+1)*temp(n-k+1)/h^(k/v);
  56.     end
  57.     y(i) = (sum(temp)+r(i))/a;
  58.     temp = zeros(1,n);
  59. end
  60. y = [0 y(1:length(y)-1)];
  61. %plot(t,y)
复制代码

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-21 16:47 , Processed in 0.061916 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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