Program for Impulsive Difference Equations
10 views (last 30 days)
Show older comments
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 Comments
Jon
on 19 Aug 2019
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.
Accepted Answer
Jon
on 20 Aug 2019
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 Comments
More Answers (0)
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!