Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Problem with difference equation
Replies: 4   Last Post: Jun 27, 2010 8:48 AM

 Messages: [ Previous | Next ]
 for_next Posts: 64 Registered: 10/12/07
Problem with difference equation
Posted: Jun 27, 2010 4:52 AM

Hi folks, I have to use difference equation to find second derivative of sin function.
This is the function g1*sin(2*pi*t/T). I use approximation with central finite difference of second order with second-order accuracy. It's it fpp(x) = ( f(x+h) -2f(x) + f(x-h) ) / h^2.... When i wrote simple program to prove that this approximation works, and it is:

clear, clc
% params of sin function
t = 0:0.01:1;
Ts = 0.01;
g1 = 0.6; T = 0.2;
% the second order differential of sin function
tpp = -4 * g1 * pi^2 * sin(2 * pi * t / T) / T^2;
% the second order difference of sin function
tdd = (sin(2 * pi * (t+Ts) / T) - 2*sin(2 * pi * t / T) + sin(2 * pi * (t-Ts) / T)) /Ts^2;
% plot the result
plot(t, t1dpp, '-b', t, t1dd, '-r')

Then I plotted the result the sins are different - with differential equation the Amp it (-600; 600) and with difference it's (-1000; 1000).
I'm new to difference equation i try to do my best, but i can't managed with this problem. Can someone help me ? I need the approximation to be same as the second derivative of sin function.
Thanks !

Date Subject Author
6/27/10 for_next
6/27/10 John D'Errico
6/27/10 for_next
6/27/10 John D'Errico
6/27/10 Greg Heath