hi, i need your help, y''=xy, y(0)=0 and y(0)=1 this second order DE i can solve in power series method i got recurrence relation

조회 수: 2 (최근 30일)
I can already solve center moving series, but how I can solve 50 and 100 order power series with plot.
This is my code:
h=0
a(0)=0;
a(1)=1;
N=50;
%x=0:0.0001:0.01;
%y=['a0+a1*x+a2*x.^2+...+a50*x^50'];
% plot(x,y, 'g', 'linewidth',1)
for n=2:N
a(n)=(a(n-3)+a(n-2))/(n)*(n-1);
end
disp(a)

답변 (2개)

Roger Stafford
Roger Stafford 2014년 10월 31일
편집: Roger Stafford 2014년 10월 31일
I don't agree with your recurrence equation, Jamila. For the series I get:
y = x + x^4/(3*4) + x*7/(3*4*6*7) + x10/(3*4*6*7*9*10) + ...
This is a very fast converging series, so you should be able make plots of it easily over a far larger range than just 0 to 0.01 .

Image Analyst
Image Analyst 2014년 10월 31일
Your for loop has to start with n=4, and you need to define a(1) through a(3) before the loop starts because you start using a(n-4) immediately within the loop.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by