How do i find a difference equation?

I have this first order differential equation given:
i need to find a difference equation using MATLAB. I would appreciate if someone could help me with that. Thanks

댓글 수: 2

Wayne King
Wayne King 2013년 1월 24일
what is u(t) here? is that the step function?
LeBron
LeBron 2013년 1월 24일
its the input

댓글을 달려면 로그인하십시오.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 24일

1 개 추천

Choose your sample time Te
Te=0.1 % Your sample time
N=1.5
D=[1 -0.5]
Modelc=tf(N,D) % Your continue transfer function
Modeld=c2d(Modelc,Te) % Your discrete transfer function
[Nd,Dd]=tfdata(Modeld,'v');
% From Y(z)/U(z)=Nd(z)/Dd(z) you can find the relation between y{n] and u[n]

댓글 수: 10

LeBron
LeBron 2013년 1월 24일
I am kinda confused i need to get the answer in this form: y(n+1)=1.05 y(n) + 0.15 u(n) as in previous question this is what i calculated without using Matlab
Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 24일
No, when you discretize a continuous system you have to take in account the two blocks ADC and DAC. If H(p) is the transfer function of your continuous system then, if you discretize, using a zoh method: the discrete transfer function G(z) will be
G(z)=(z/(z-1))*Ztransform(inverse_transform(H(p)/p))
LeBron
LeBron 2013년 1월 24일
편집: LeBron 2013년 1월 24일
It would be better if you tell me exactly what to type in matlab so i should type everything u have told me in first post plus this last thing G(z)=(z/(z-1))*Ztransform(inverse_transform(H(p)/p))
then i should get my final answer?
Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 24일
LeBron, I gave you the code which allows to find your discrete transfer function G(z). Do you know how to find the difference equation from G(z)? Other thing
G(z)=(z/(z-1))*Ztransform(inverse_transform(H(p)/p))
is not a code, it's what the above code is doing
Roger Stafford
Roger Stafford 2013년 1월 24일
편집: Azzi Abdelmalek 2013년 1월 25일
I would advise you to look at the article
It gives an explanation of various Runga-Kutta methods of approximating the solution to ordinary differential equations of the kind you have. The discussion of RK4 shows you one method which is a fourth order approximation wherein it is assumed you can sample your u(t) at every h/2 interval with a step size of h in t. The f(t,y) they describe would be
f(t,y) = 1.5*u(t)+.5*y
in your case, and the corresponding difference equations are given there.
The article also describes other possible kinds of difference equations that one can use with differing amounts of accuracy.
Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 25일
편집: Azzi Abdelmalek 2013년 1월 25일
He is asking for a difference equation, not a numeric resolution.
LeBron
LeBron 2013년 1월 25일
Azzi, No, I dont know how to find the difference equation from G(z). Thanks
For example
1 Y(z)
G(z)=----- = ------
z + 2 U(z)
Then
Y(z)(z+2)=U(z)
zY(z)+2Y(z)=U(z)
y[n+1]+2y[n]=u[n]
Roger Stafford
Roger Stafford 2013년 1월 25일
Azzi, the Runga-Kutta method does give a set of difference equations, in fact a very respectable set indeed.
LeBron
LeBron 2013년 1월 25일
편집: LeBron 2013년 1월 25일
Hey Azzi thank you so much for all your help. I really appreciate it. People like you make this forum a great place.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by