Program for Impulsive Difference Equations
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Gokula Nanda
el 19 de Ag. de 2019
Comentada: Jon
el 21 de Ag. de 2019
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 comentarios
Jon
el 19 de Ag. de 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.
Respuesta aceptada
Jon
el 20 de Ag. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Filter Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!