Azzera filtri
Azzera filtri

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 visualizzazioni (ultimi 30 giorni)
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)

Risposte (2)

Roger Stafford
Roger Stafford il 31 Ott 2014
Modificato: Roger Stafford il 31 Ott 2014
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 il 31 Ott 2014
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.

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by