Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I programmed a Nystrom Algorithm specifically for my problem:

This is the exact equation i want to solve:


And this is my algorithm

function [T U] = Nystrom(a,b,u0,h,w,v,e)
% a is the initial value
% b is the final value
% u0 is a vector with the initial conditions y(0) and y'(0)
% h is the size of every step
% w, v and e are constants.

M=(b-a)/h+2; %Steps
T=zeros(1,M+2); %Time vectors
U=zeros(2,M+2); %y and y' vector
T=a:h:b; % i use uniform steps of size h
U(:,1)=u0; %i stablish the initial conditions

U(1,2)=U(1,1)+h*U(2,1)+(h^2)/2 * (w^2-e*cos(T(1))*sin(U(1,1))-v*U(2,1));

for i=3:M

for i=1:M


The problem is, it doesn't work and i don't know why. It's throwing values bigger and bigger in every step, but solving the same problem with other methods gives different, quite smaller values.

Any idea could help. Thank you!

share|cite|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.