Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. >> pkg load symbolic
  2. >> syms y(t)t
  3. Symbolic pkg v2.8.0: Python communication link active, SymPy v1.4.
  4. error: invalid symfun expression
  5. error: called from
  6. assert at line 94 column 11
  7. syms at line 167 column 7
  8. >> egy= diff(y(t),t)==-y/20
  9. error: 't' undefined near line 1 column 13
  10. >>
  11. >> syms y(t)t
  12. error: invalid symfun expression
  13. error: called from
  14. assert at line 94 column 11
  15. syms at line 167 column 7
  16. >> syms y(t) t
  17. >> egy= diff(y(t),t)==-y/20
  18. egy = (sym)
  19.  
  20. d -y(t)
  21. --(y(t)) = ------
  22. dt 20
  23.  
  24. >> dsolve(egy)
  25. ans = (sym)
  26.  
  27. -t
  28. ---
  29. 20
  30. y(t) = C1*e
  31.  
  32. >> matlabFunction(rhs(dsolve(egy)))
  33. ans =
  34.  
  35. @(C1, t) C1 .* exp (-t / 20)
  36.  
  37. >> dsolve(egy, y(0)==10)
  38. ans = (sym)
  39.  
  40. -t
  41. ---
  42. 20
  43. y(t) = 10*e
  44.  
  45. >> f = @(t,y) -y/20 ;
  46. >> tb = -4:4
  47. tb =
  48.  
  49. -4 -3 -2 -1 0 1 2 3 4
  50.  
  51. >> yb = 0:10;
  52. >> [T,Y] = meshgrid([-2,2][3,4,5,6])
  53. parse error:
  54.  
  55. syntax error
  56.  
  57. >>> [T,Y] = meshgrid([-2,2][3,4,5,6])
  58. ^
  59.  
  60. >> [T,Y] = meshgrid(tb,ty);
  61. error: 'ty' undefined near line 1 column 21
  62. >> [T,Y] = meshgrid(tb,yb);
  63. >> dY = f(T,Y) ;
  64. >> dT = ones(size(dY));
  65. >> quiver(T,Y,dT,dY)
  66. >> sol = @(t) 10*exp(-t/20);
  67. >> xx = linspace(0,6);
  68. >> hold on;
  69. >> plot(xx,sol(xx))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement