Program for Impulsive Difference Equations
10 次查看(过去 30 天)
显示 更早的评论
Write a MATLAB program to simulate the following impulsive difference equation
where , , , and , for
(a) Find values of y[n] (b) plot the solutions over the range, 1= n = 10.
2 个评论
Jon
2019-8-19
What have you tried to do so far? What problems have you encountered? Please include your code using the code button on the MATLAB answers toolbar.
采纳的回答
Jon
2019-8-20
One way to approach this is to transform your difference equation in the single variable y to a system of two difference equations, which you can simply march forward in time.
So neglecting, for the moment the special condition when n = mk, you could define y1(n) = y(n) and y2(n) = y1(n-1), noting also that a(n), b(n) and c(n) are in fact not functions of n, but simple constants, and substituting for h(u) would give the system of equations
y1(n+1) = a*y1(n) - b*y2(n) - c*y2(n)^3
y2(n+1) = y1(n)
Assuming you have initial conditions for y you could then just march forward in a loop
a = -3/2
b = 1
c = 1/4
% assign initial conditions
y1(1)= y1ic % initial condition y for n=1
y2(1)= y2ic % initial condition y for n=0
% assign maximum iteration
nFinal = 11
% loop to march forward
preallocate
y1 = zeros(nFinal+1,1)
y2 = zeros(nFinal+1,1)
for n = 1:nFinal
y1(n+1) = a*y1(n) - b*y2(n) - c*y2(n)^3
y2(n+1) = y1(n)
end
% plot results (note y1 = y the variable you are interested in)
plot(y1) % with only one argument the x axis will just be the value of n
You will have to further modify your code to handle the special condition where n = m*k. I actually can't understand the details of what your are doing there from the description, for example I don't see where I_k is defined.
Hopefully this gives you a start on how to approach this.
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!