18 questions
0
votes
1
answer
97
views
deSolve difference equations returning static output
I am trying to model a series of difference equations in R using the deSolve package and method = "iteration", but the output is just returning the initial values with no changes, and I do ...
1
vote
1
answer
83
views
Square Root program using Difference Equations
I made a program using difference equation initial conditions for each number, but as you can see the code didn't give me satisfying results, plus it took more loops than it's supposed to, it should ...
0
votes
1
answer
192
views
Question about reformulating a difference equation as a matrix equation
The difference equation and the boundary value are:
y(n)-10.1y(n-1)+y(n-2)=-1.35n,y(-1)=0,y(100)=101/6
I have managed to solve for y(n) with eigenvector to obtain the homogeneous solution and ...
2
votes
3
answers
134
views
IndexError trying to solve difference equations numerically in python
I'm practicing how to numerically solve difference equations, but I often run into problems like the one below.
Can anyone help me sort this out?
import numpy as np
N = 10
#alternative 1
#x = np....
0
votes
2
answers
2k
views
How to numerically solve difference equations in python
I am trying to learn how to solve difference equations (also called recurrence relations) using python.
The problem in question is the equation
$x_{n+2} - 4x_{n+1} - x_{n} = 0$ where x_0 = 1 and ...
0
votes
1
answer
148
views
Search for optimal parameter value with curve fitting (difference equations)
I have two experimentally determined variables (y1_exp, y2_exp) which change with x, where y2_exp affects y1_exp with changing x (however y1_exp does not affect y2_exp). Here is the data:
library(...
0
votes
1
answer
29
views
Propotional growth in difference equations
Xn denoting the number of affected children after n weeks. Initially, 2 children were affected and 3 more reported affected in the first week of the outbreak.
I know X0 = 2 but I am confused with X1=...
2
votes
1
answer
1k
views
How to solve real life difference equations using python
I want to solve a difference equation using python.
y = x(n - 1) - (0.5(x(n-2) + x(n))
x here is a long array of values. I want to plot y with respect to another time sequence array t using Plotly. ...
2
votes
0
answers
2k
views
how to solve a difference equation using Z transform in Matlab
I'm trying to find the impulse response of a filter expressed by a difference equation as below:
y[n] - y[n-1] + 0.9*y[n-2] = x[n] - x[n-2]
I want to use Z-transform in order to solve he equation. I ...
18
votes
2
answers
2k
views
How to write a cumulative calculation in data.table
A sequential, cumulative calculation
I need to make a time-series calculation, where the value calculated in each row depends on the result calculated in the previous row. I am hoping to use the ...
0
votes
1
answer
72
views
Solving a pair of real (and interwined) equations
I have a first-order difference equation: y[n] = z0 * [n-1] + x[n] (2-3). Usually what we would do is apply the z-transform, then use the "filter" function. But my teacher wants to do it differently:
...
2
votes
1
answer
1k
views
Numerical Solution of System of Difference/Differential Algebraic Equations in Maxima
I begin with a system of difference equations (an oversimplified Solow-Romer economic model):
Where the t subscripts indicate discrete time, such as Y[t=0], Y[t=1], Y[t=2], ...
Specifically:
eq1: Y[...
0
votes
1
answer
153
views
How do I solve this complexity equation,T(n) = T(n-3)+T(n-5) [closed]
While solving a puzzle, I ended up having a complexity of T(n)=T(n-3)+T(n-5).
I was trying subtraction method. But I am unable to solve this. Please explain what should be the procedure.
-1
votes
1
answer
221
views
transfer function in z-form from Difference equation, Matlab
Is there any function to get a transfer function in z form from difference equation in Matlab?
1
vote
0
answers
4k
views
Difference equation from transfer function, Matlab
I plotted the responses of two difference equation obtained from a Z transform transfer function. I used two methods and get two different results. Why?
tf = y(output)/u(input) = z/ (z^2 - 3z + 3)
...
3
votes
2
answers
184
views
numpy: evaluating function in matrix, using previous array as argument in calculating the next
I have an m x n array: a, where the integers m > 1E6, and n <= 5.
I have functions F and G, which are composed like this: F( u, G ( u, t)). u is a 1 x n array, t is a scalar, and F and G ...
2
votes
1
answer
1k
views
Difference equations in Symbolic Toolbox Matlab
Can someone please tell me is there a way to solve difference equation e.g:
y(k) = a1 * y(k-1) + a2 * y(k-2) + b0*u(k)
in Matlab using Symbolic Toolbox? I want to find explicit solution of this ...
1
vote
1
answer
1k
views
difference equations in MATLAB - why the need to switch signs?
Perhaps this is more of a math question than a MATLAB one, not really sure. I'm using MATLAB to compute an economic model - the New Hybrid ISLM model - and there's a confusing step where the author ...