Advertisement
akocius

lab

Oct 30th, 2020
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %% 1a
  2. clear all
  3. clc
  4. syms t p
  5. f = (cos(t))^3;
  6. L = laplace(f, t, p)
  7. pretty(L)
  8.  
  9. %% 1b
  10. clear all
  11. clc
  12. syms t p
  13. f = (sin(t))^2;
  14. L = laplace(f, t, p)
  15.  
  16. %% 1c
  17. clear all
  18. clc
  19. syms t p
  20. f = (1/3)*sin(3*t)-5;
  21. L = laplace(f, t, p)
  22.  
  23. %% 1d
  24. clear all
  25. clc
  26. syms t p
  27. f = 4*t^2 - 2*t +3;
  28. L = laplace(f, t, p)
  29.  
  30. %% 1e
  31. clear all
  32. clc
  33. syms t p
  34. f = 4 - 5*exp(2*t);
  35. L = laplace(f, t, p)
  36.  
  37. %% 1f
  38. clear all
  39. clc
  40. syms t p
  41. f = (1/3)*t^3 + 4*cos(2*t);
  42. L = laplace(f, t, p)
  43.  
  44. %% 1g
  45. clear all
  46. clc
  47. syms t p
  48. f = exp(t)*(cos(t))^2;
  49. L = laplace(f, t, p)
  50.  
  51. %% 2h
  52. clear all
  53. clc
  54. syms t p
  55. F = p/(p^2 - 2*p + 5);
  56. L = ilaplace(F, p, t)
  57. pretty(L)
  58.  
  59. %% 2i
  60. clear all
  61. clc
  62. syms t p
  63. F = 1/(p^3-8)
  64. L = ilaplace(F, p, t)
  65.  
  66. %% 2j
  67. clear all
  68. clc
  69. syms t p
  70. F = 1/((p-1)*(p^2-4));
  71. L = ilaplace(F, p, t)
  72.  
  73. %% 2k
  74. clear all
  75. clc
  76. syms t p
  77. F = (p+3)/(p*(p^2-4*p+3));
  78. L = ilaplace(F, p, t)
  79.  
  80. %% 2_1
  81. clear all
  82. clc
  83. syms t p
  84. F = 1/(p^3+2*p^2+p);
  85. L = ilaplace(F, p, t)
  86.  
  87. %% 3a
  88. clear all
  89. clc
  90. syms x y(x)
  91. lygtis = x*diff(y,x) == 2*x^2;
  92. y_spr(x) = dsolve(lygtis)
  93. for C1 = -3:3
  94.     fplot(x^2 + C1, [-3 3]);
  95.     hold on
  96.     drawnow
  97. end
  98.  
  99. %% 3b
  100. clear all
  101. clc
  102. syms x y(x)
  103. lygtis = (x-2)*sqrt(y) == x*diff(y,x);
  104. y_spr(x) = dsolve(lygtis)
  105. for C1 = -3:3
  106.     fplot((C1 + x/2 - log(x))^2, [-3 3]);
  107.     hold on
  108.     drawnow
  109. end
  110.  
  111. %% 3c
  112. clear all
  113. clc
  114. syms x y(x)
  115. lygtis = diff(y,x)*sin(x)*cos(x) + y*(cos(x))^2 == (sin(x))^2;
  116. y_spr(x) = dsolve(lygtis)
  117. for C1 = -3:3
  118.     fplot((log(tan(x/2 + pi/4)) - sin(x))/sin(x) + C1/sin(x), [-3 3]);
  119.     hold on
  120.     drawnow
  121. end
  122.  
  123. %% 3d
  124. clear all
  125. clc
  126. syms x y(x)
  127. lygtis = x*diff(y,x)-y == 3*x;
  128. y_spr(x) = dsolve(lygtis)
  129.  
  130. for C1 = -3:3
  131.     fplot(C1*x + 3*x*log(x), [-3 3]);
  132.     hold on
  133.     drawnow
  134. end
  135.  
  136. %% 3e
  137. clear all
  138. clc
  139. syms x y(x)
  140. lygtis = diff(y,x,3) == x*exp(x);
  141. y_spr(x) = dsolve(lygtis)
  142.  
  143. for C1 = -2:2
  144.     for C2 = -2:2
  145.         for C3 = -2:2
  146.             fplot(C3 - 3*exp(x) + C2*x + (C1*x^2)/2 + x*exp(x), [-2 2]);
  147.             hold on
  148.             drawnow
  149.         end
  150.     end
  151. end
  152.  
  153. %% 3f
  154. clear all
  155. clc
  156. syms x y(x)
  157. lygtis = diff(y,x,2)-diff(y,x)-12*y == 0;
  158. y_spr(x) = dsolve(lygtis)
  159.  
  160. for C1 = -3:3
  161.     for C2 = -3:3
  162.         fplot(C1*exp(-3*x) + C2*exp(4*x), [-3 3]);
  163.         hold on
  164.         drawnow
  165.     end
  166. end
  167.  
  168. %% 3g
  169. clear all
  170. clc
  171. syms x y(x)
  172. lygtis = diff(y,x,3) - diff(y,x,2) + diff(y,x) - y == x^2 + x;
  173. y_spr(x) = dsolve(lygtis)
  174.  
  175. for C1 = -2:2
  176.     for C2 = -2:2
  177.         for C3 = -2:2
  178.             fplot(C2*cos(x) - 3*x + C1*exp(x) - C3*sin(x) - x^2 - 1, [-2 2]);
  179.             hold on
  180.             drawnow
  181.         end
  182.     end
  183. end
  184.  
  185. %% 3h
  186. clear all
  187. clc
  188. syms x y(x)
  189. lygtis = diff(y,x,2) + 4*diff(y,x) + 4*y == 8*exp(-2*x);
  190. y_spr(x) = dsolve(lygtis)
  191.  
  192. for C1 = -3:3
  193.     for C2 = -3:3
  194.         fplot(4*x^2*exp(-2*x) + C1*exp(-2*x) + C2*x*exp(-2*x), [-3 3]);
  195.         hold on
  196.         drawnow
  197.     end
  198. end
  199.  
  200. %% 3i
  201. clear all
  202. clc
  203. syms x y(x)
  204. lygtis = diff(y,x,2) + 4*diff(y,x) - 12*y == 8*sin(2*x);
  205. Dy = diff(y,x);
  206. reiksmes = [y(0)==0, Dy(0)==0];
  207. y_spr(x) = dsolve(lygtis, reiksmes)
  208.  
  209. fplot(exp(2*x)/4 - exp(-6*x)/20 - (5^(1/2)*cos(2*x - atan(2)))/5, [-5 5])
  210.  
  211. %% 3j
  212. clear all
  213. clc
  214. syms x y(x)
  215. lygtis = diff(y,x,2) - 4*diff(y,x) + 13*y == 26*x + 5;
  216. Dy = diff(y,x);
  217. reiksmes = [y(0)==1, Dy(0)==0];
  218. y_spr(x) = dsolve(lygtis, reiksmes)
  219.  
  220. fplot(2*x - (2*sin(3*x)*exp(2*x))/3 + 1, [-5 5])
  221.  
  222. %% 3k
  223. clear all
  224. clc
  225. syms x y(x)
  226. lygtis = diff(y,x,2) - 4*diff(y,x) == 6*x^2 + 1;
  227. Dy = diff(y,x);
  228. reiksmes = [y(0)==2, Dy(0)==3];
  229. y_spr(x) = dsolve(lygtis, reiksmes)
  230.  
  231. fplot((55*exp(4*x))/64 - (7*x)/16 - (3*x^2)/8 - x^3/2 + 73/64, [-5 5])
  232.  
  233. %% 3l
  234. clear all
  235. clc
  236. syms t x(t) y(t)
  237. lygtis1 = diff(x,t) == 3*x + y;
  238. lygtis2 = diff(y,t) == 8*x + y;
  239. [x_spr(t) y_spr(t)] = dsolve([lygtis1 lygtis2]);
  240. x_spr(t) = simplify(x_spr(t))
  241. y_spr(t) = simplify(y_spr(t))
  242.  
  243. for C1 = -3:3
  244.     for C2 = -3:3
  245.         fplot((C2*exp(5*t))/2 - (C1*exp(-t))/4, [-3 3])
  246.         title('xspr(t)')
  247.         hold on
  248.         drawnow
  249.     end
  250. end
  251.  
  252. figure(2)
  253. for C1 = -3:3
  254.     for C2 = -3:3
  255.         fplot(C1*exp(-t) + C2*exp(5*t), [-3 3])
  256.         title('yspr(t)')
  257.         hold on
  258.         drawnow
  259.     end
  260. end
Advertisement
RAW Paste Data Copied
Advertisement