matlab求递归问题,matlab利用递归求解差分方程

本文介绍了如何使用matlab实现递推方法求解差分方程,详细解析了递推过程中的循环逻辑,并澄清了递推与递归的区别。通过示例代码解释了每个步骤的作用,帮助理解如何根据已知条件逐步计算未知项。
摘要由CSDN通过智能技术生成

导航:网站首页 >

matlab利用递归求解差分方程

时间:2018-5-23

matlab利用递归求解差分方程

function y = recur(a,b,n,x,x0,y0);

%

% y = recur(a,b,n,x,x0,y0)

% solves for y[n] from:

% y[n] + a1*y[n-1] + a2*y[n-2]...+ an*y[n-N]

% = b0*x[n] + b1*x[n-1] + ...+ bm*x[n-M]

%

% a,b,n,x,x0 and y0 are vectors

% a = [a1 a2 ...aN]

% b = [b0 b1 ...bM]

% n contains the time values for which the solution will be computed

% y0 contains the initial conditions for y,in order,

% i.e.,y0 = [y[n0-N],y[n0-N+1],...,y[n0-1]]

% where n0 represents the first element of n

% x0 contains the initial conditions on x,in order

% i.e.,x0 = [x[n0-M],...,x[n0-1]]

% the output,y,has length(n)

%

N = length(a);

M = length(b)-1;

y &#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值