سلام مهندس جان
من یه پروژه محاسبات عددی دارم در باره حل دستگاه معادلات دیفرانسیل با روش shooting
مثل حل d2y/dx2+h(y0-y)=0 ; که باید تبدیل به دستگاه زیر بشه
dy/dx=z
dz/dx+h(y0-y)=0
که y0 , h معلومند و z باید حدس زده بشه ولی مشکلم تو حلقه for هستش که چطوری باید i رو با y های مختلف ارتباط بدم
شروع برنامه ام هم اینه
%this program solve the dastgah madelat diffrancial ba ravesh shooting
%
h=input('please insert the the h : ');
A=input('please insert the the A : ');
yA=input('please insert the the y(A) : ');
B=input('please insert the the B : ');
yB=input('please insert the the Y(B) : ');
y0=input('please insert the the y0 : ');
k=input('please insert the step size k : ');
n=(B-A)/k ;
z0=input('please guess the dy/dx : ');
for i= 1 : n
y('i')=y('i'-1)+z*k;
z('i'+1)=z0-h*(y('i')-y0);
end
یعنی باید y به تعداد i های متفاوت حساب بشه ولی بلد نیستم بنویسم میتونی کمکم کنی؟