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