مهندسی مکانیک دانشگاه خلیج فارس

آموزش نرم افزار ها, کتب و جزوات دروس مهندسی مکانیک , مقالات مربوطه و غیره را در این سایت ببینید

مهندسی مکانیک دانشگاه خلیج فارس

آموزش نرم افزار ها, کتب و جزوات دروس مهندسی مکانیک , مقالات مربوطه و غیره را در این سایت ببینید

تبلیغات
Blog.ir بلاگ، رسانه متخصصین و اهل قلم، استفاده آسان از امکانات وبلاگ نویسی حرفه‌ای، در محیطی نوین، امن و پایدار bayanbox.ir صندوق بیان - تجربه‌ای متفاوت در نشر و نگهداری فایل‌ها، ۳ گیگا بایت فضای پیشرفته رایگان Bayan.ir - بیان، پیشرو در فناوری‌های فضای مجازی ایران
طبقه بندی موضوعی
نویسندگان

روش تکرار ( Fixed point iteration method )                دانلود              رمز فایل : AliAshouri


disp ('                This is the code of Fixed point iteration method.Is writen by Ali Ashouri and Nima Ashrafi')
format long
disp (' ')
disp (' ')
disp ('    ********Before enter anything read all of introduction that will write. read all of them*******')
disp (' ')
disp (' at first calculate the differential function which used in this method.so write at commond window:')
disp (' ')


disp (' syms y;')
disp (' diff(f(y)) ------- f(y) is your function at term like sin(y) or y.^2')
disp (' ')
disp (' ')
disp ('                 x must be at double class and before play the program write its limit in commond window. like: x=-1:0.00001:1')
disp (' ')
disp ('                real function should be start by @(x) like : @(x) sin(x)')
disp (' ')
disp ('                secondary function should be start by @(x) like : @(x) sin(x)')
disp (' ')
disp ('                differential of secondary function should be start by @(x) like : @(x) sin(x)')
disp (' ')
f=input('enter your real function :  ');
g=input('enter your secondary function :  ');
h=input('enter your differential of secondary function :  ');
a=input('enter the first number of limit :  ');
b=input('enter the final number of limit :  ');
x0=input('enter the x0 number :  ');
disp (' ')
disp (' ')
disp (' If you have not any epsilon, for eps or d enter 0 (zero) ')
disp (' ')
xn=g(x0);
d=input('Enter the epsilon or d number :  ');
while ( max(g(x))>b || min(g(x))<a)
    disp('    your secondary function is uncorrect at inputed limit   ')
    g=input('enter your secondary function :  ');
    h=input('enter your differential of secondary function :  ');
end;
while ( max(abs(h(x)))>max(abs(a),abs(b)))
    disp('    your secondary function is uncorrect at inputed limit   ')
    g=input('enter your secondary function :  ');
    h=input('enter your differential of secondary function :  ');
    while ( max(g(x))>b || min(g(x))<a)
    disp('    your secondary function is uncorrect at inputed limit   ')
    g=input('enter your secondary function :  ');
    h=input('enter your differential of secondary function :  ');
    end;
end;
tic
  if d==0
      c=g(x0);
      n=1;
      disp('n     I             x0           I             xn           ')
      disp ------------------------------------------------------------------------------------------------------------------------------------
      r=[num2str(n),'       I   ',num2str(x0),'           I         ',num2str(c)];
      disp (r)
      while (xn>x0 || xn<x0)
              x0=xn;
              xn=g(x0);
              n=n+1;
              r=[num2str(n),'       I   ',num2str(x0),'           I         ',num2str(xn)];
              disp (r)
      end
  else
      xn=g(x0);
      n=1;
      disp('n     I             x0           I             xn                    |                    f(xn)')
      disp ------------------------------------------------------------------------------------------------------------------------------------
      r=[num2str(n),'       I   ',num2str(x0),'           I         ',num2str(xn),'               |            ',num2str(f(xn))];
      disp (r)
      while abs(f(xn))>d
           x0=xn;
          xn=g(x0);
          n=n+1;
          r=[num2str(n),'       I   ',num2str(x0),'           I         ',num2str(xn),'               |            ',num2str(f(xn))];
          disp (r)
      end;
  end;
disp ('           ')
disp (['                          xn=      ',num2str(xn)])
disp (['                          n=      ',num2str(n)])
toc;

  • علی عاشوری

نظرات  (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی