SHARE
TWEET

Untitled

a guest Apr 26th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     clc
  3.     funcprot(0)
  4.     printf("Лабораторная работа №15\n")
  5.     printf(" Задание 1\n")
  6.     function w =f(x,y)
  7.     w=(y/x)+3/((x^2)+x)
  8.     endfunction
  9.  
  10.     format('v',6)
  11.     x0=3; y0=2;
  12.     x=[3:10];
  13.     z=ode(y0,x0,x,f);
  14.     plot(x,z,'-*'); xgrid()
  15.     mprintf(" x = %2.0f %2.0f %2.0f %2.0f %2.0f %2.0f %2.0f %2.0f\n",x)
  16.     mprintf(" z = %2.0f %2.2f %2.2f %2.1f %2.2f %2.2f %2.2f %2.1f",z)
  17.     a=gca();
  18.     a.x_location = "origin";
  19.     a.y_location = "origin";
  20.  
  21.     scf
  22.     printf("\n **************************************************\n")
  23.     printf(" Задание 2\n")
  24.     function w = f(x,y)
  25.     w = (y+(x^2)*cos(x))/2
  26.     endfunction
  27.  
  28.     format('v',5)
  29.     x0=2.5; y0=2.3;
  30.     x=[2.5:0.5:9];
  31.     z=ode(y0,x0,x,f);
  32.     plot(x,z,'-*'); xgrid()
  33.     mprintf(" x = %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f %2.1f\n",x)
  34.     mprintf(" z = %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f",z)
  35.  
  36. clc
  37.     printf("Лабраторная работа №14\n")
  38.     printf(" Задание 1\n\n")
  39.     x = 1:0.01:5
  40.     y = 2 * sin(x)^2
  41.     Jspl = intsplin(x,y)
  42.     printf(' Jсплайн = %7.5f\n', Jspl)
  43.     Jtr = inttrap(x,y)
  44.     printf(' Jтрап = %7.5f\n', Jtr)
  45.  
  46.     printf("\n *****************************\n")
  47.     printf(" Задание 2\n")
  48.     Jtr=inttrap([0 1 3 4 6 9 10], [1 3 2 3 5 3 4])
  49.     printf('\n Jтрап = %5.2f\n', Jtr)
  50.  
  51.     printf("\n *****************************\n")
  52.     printf(" Задание 3\n")
  53.     x = -10:0.01:8
  54.     function y = m(x)
  55.     y = x^2 + sin(x)
  56.     endfunction
  57.  
  58.     Jintg = intg(-10, 8, m)
  59.     printf('\n Jintg = %7.5f\n', Jintg)
  60.  
  61.     Jkv = integrate('x^2 + sin(x)', 'x', -10, 8)
  62.     printf(' Jквадратур = %7.5f\n', Jkv)
  63.  
  64.     y = x^2 + sin(x)
  65.     Jtr = inttrap(x,y)
  66.     printf(' Jтрап = %7.5f\n', Jtr)
  67.  
  68.     printf("\n *****************************\n")
  69.     printf(" Задание 4\n")
  70.     x = [1 3 4 6 9 10]
  71.     y = log(x)
  72.     Jspl = intsplin(x,y)
  73.     printf('\n Jсплайн = %7.5f\n', Jspl)
  74.     Jtr = inttrap(x,y)
  75.     printf(' Jтрап = %7.5f\n', Jtr)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top