Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.21 KB | None | 0 0
  1.  
  2. This is a Classroom License for instructional use only.
  3. Research and commercial use is prohibited.
  4.  
  5. >> a=2
  6.  
  7. a =
  8.  
  9. 2
  10.  
  11. >> a=2;
  12. >> b=4;
  13. >> a+b;
  14. >> c=a+b;
  15. >> A=[1,2,3]
  16.  
  17. A =
  18.  
  19. 1 2 3
  20.  
  21. >> At
  22. Undefined function or variable 'At'.
  23.  
  24. >> A^
  25. A^
  26. ↑
  27. Error: Expression or statement is incomplete or incorrect.
  28.  
  29. >> A*
  30. A*
  31. ↑
  32. Error: Expression or statement is incomplete or incorrect.
  33.  
  34. >> A*A*
  35. A*A*
  36. ↑
  37. Error: Expression or statement is incomplete or incorrect.
  38.  
  39. >> A*A'
  40.  
  41. ans =
  42.  
  43. 14
  44.  
  45. >> A(1)
  46.  
  47. ans =
  48.  
  49. 1
  50.  
  51. >> A(4)
  52. Index exceeds matrix dimensions.
  53.  
  54. >> A= 1:5:100
  55.  
  56. A =
  57.  
  58. Columns 1 through 16
  59.  
  60. 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76
  61.  
  62. Columns 17 through 20
  63.  
  64. 81 86 91 96
  65.  
  66. >> max(A)
  67.  
  68. ans =
  69.  
  70. 96
  71.  
  72. >> help max
  73. max Largest component.
  74. For vectors, max(X) is the largest element in X. For matrices,
  75. max(X) is a row vector containing the maximum element from each
  76. column. For N-D arrays, max(X) operates along the first
  77. non-singleton dimension.
  78.  
  79. [Y,I] = max(X) returns the indices of the maximum values in vector I.
  80. If the values along the first non-singleton dimension contain more
  81. than one maximal element, the index of the first one is returned.
  82.  
  83. max(X,Y) returns an array the same size as X and Y with the
  84. largest elements taken from X or Y. Either one can be a scalar.
  85.  
  86. [Y,I] = max(X,[],DIM) operates along the dimension DIM.
  87.  
  88. When X is complex, the maximum is computed using the magnitude
  89. max(ABS(X)). In the case of equal magnitude elements, then the phase
  90. angle max(ANGLE(X)) is used.
  91.  
  92. max(..., NANFLAG) specifies how NaN (Not-A-Number) values are treated.
  93. NANFLAG can be:
  94. 'omitnan' - Ignores all NaN values and returns the maximum of the
  95. non-NaN elements. If all elements are NaN, then the
  96. first one is returned.
  97. 'includenan' - Returns NaN if there is any NaN value. The index points
  98. to the first NaN element.
  99. Default is 'omitnan'.
  100.  
  101. Example: If X = [2 8 4; 7 3 9] then
  102. max(X,[],1) is [7 8 9],
  103. max(X,[],2) is [8; 9] and
  104. max(X,5) is [5 8 5; 7 5 9].
  105.  
  106. See also min, cummax, median, mean, sort.
  107.  
  108. Reference page for max
  109. Other functions named max
  110.  
  111. >> [maxim, idx] = max(A)
  112.  
  113. maxim =
  114.  
  115. 96
  116.  
  117.  
  118. idx =
  119.  
  120. 20
  121.  
  122. >> B=[1,2,3;4,5,6]
  123.  
  124. B =
  125.  
  126. 1 2 3
  127. 4 5 6
  128.  
  129. >> B(1,2)
  130.  
  131. ans =
  132.  
  133. 2
  134.  
  135. >> B(2,2)
  136.  
  137. ans =
  138.  
  139. 5
  140.  
  141. >> A(2:3)
  142.  
  143. ans =
  144.  
  145. 6 11
  146.  
  147. >> A
  148.  
  149. A =
  150.  
  151. Columns 1 through 19
  152.  
  153. 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91
  154.  
  155. Column 20
  156.  
  157. 96
  158.  
  159. >> A = [A;A;A;A]
  160.  
  161. A =
  162.  
  163. Columns 1 through 19
  164.  
  165. 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91
  166. 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91
  167. 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91
  168. 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91
  169.  
  170. Column 20
  171.  
  172. 96
  173. 96
  174. 96
  175. 96
  176.  
  177. >> plot(1:5:10,1:5:10)
  178. >> plot(1:5:10,1:5:10, 'LineWidth', 2)
  179. >> plot(1:5:10,1:5:10, 'r', 'LineWidth', 2)
  180. >> plot(1:5:10,1:5:10, 'r-', 'LineWidth', 2)
  181. >> plot(1:5:10,1:5:10, '-r', 'LineWidth', 2)
  182. >> plot(1:5:10,1:5:10, 'r--', 'LineWidth', 2)
  183. >> plot(1:5:10,1:5:10, 'r---', 'LineWidth', 2)
  184. Error using plot
  185. Error in color/linetype argument.
  186.  
  187. >> plot(1:5:10,1:5:10, 'r*', 'LineWidth', 2)
  188. >> plot(1:5:10,1:5:10, 'r-*', 'LineWidth', 2)
  189. >> legend(test)
  190. Undefined function or variable 'test'.
  191.  
  192. >> legend('test')
  193. >> plot(1:5:10,1:5:10, 'r-*', 'LineWidth', 2)
  194. >> grid on
  195. >> hold on
  196. >> plot(1:5:10,1:5:10, 'r-*', 'LineWidth', 2)
  197. >> grid on
  198. >> plot(1:5:10,1:5:10, 'r-*', 'LineWidth', 2)
  199. >> legend('test')
  200. >> legend('test2')
  201. >> legend('test2', 'test')
  202. Warning: Ignoring extra legend entries.
  203. > In legend>set_children_and_strings (line 629)
  204. In legend>make_legend (line 321)
  205. In legend (line 247)
  206. >> legend('test2')
  207. >> figure()
  208. >> bar(1:5:10, 1:8:10)
  209. >> bar(1:5:10, 1:8:10, 'r--')
  210. Error using matlab.graphics.chart.primitive.Bar/set
  211. There is no Marker property on the Bar class.
  212.  
  213. Error in matlab.graphics.chart.internal.ctorHelper (line 6)
  214. set(obj, pvpairs{:});
  215.  
  216. Error in matlab.graphics.chart.primitive.Bar
  217.  
  218. Error in bar (line 186)
  219. h(i) = matlab.graphics.chart.primitive.Bar('Parent',hPar,...
  220.  
  221. >> bar(1:5:10, 1:8:10, 'r')
  222. >> grid on
  223. >> xlabel('time')
  224. >> ylabel('t')
  225. >>
  226. >> title('tytuł')
  227. >> x=0:1:100
  228.  
  229. x =
  230.  
  231. Columns 1 through 19
  232.  
  233. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
  234.  
  235. Columns 20 through 38
  236.  
  237. 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
  238.  
  239. Columns 39 through 57
  240.  
  241. 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  242.  
  243. Columns 58 through 76
  244.  
  245. 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
  246.  
  247. Columns 77 through 95
  248.  
  249. 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
  250.  
  251. Columns 96 through 101
  252.  
  253. 95 96 97 98 99 100
  254.  
  255. >> y=2*x+1;
  256. >> plot(x,y)
  257. >> grid on
  258. >> y=x.*x+2
  259.  
  260. y =
  261.  
  262. Columns 1 through 9
  263.  
  264. 2 3 6 11 18 27 38 51 66
  265.  
  266. Columns 10 through 18
  267.  
  268. 83 102 123 146 171 198 227 258 291
  269.  
  270. Columns 19 through 27
  271.  
  272. 326 363 402 443 486 531 578 627 678
  273.  
  274. Columns 28 through 36
  275.  
  276. 731 786 843 902 963 1026 1091 1158 1227
  277.  
  278. Columns 37 through 45
  279.  
  280. 1298 1371 1446 1523 1602 1683 1766 1851 1938
  281.  
  282. Columns 46 through 54
  283.  
  284. 2027 2118 2211 2306 2403 2502 2603 2706 2811
  285.  
  286. Columns 55 through 63
  287.  
  288. 2918 3027 3138 3251 3366 3483 3602 3723 3846
  289.  
  290. Columns 64 through 72
  291.  
  292. 3971 4098 4227 4358 4491 4626 4763 4902 5043
  293.  
  294. Columns 73 through 81
  295.  
  296. 5186 5331 5478 5627 5778 5931 6086 6243 6402
  297.  
  298. Columns 82 through 90
  299.  
  300. 6563 6726 6891 7058 7227 7398 7571 7746 7923
  301.  
  302. Columns 91 through 99
  303.  
  304. 8102 8283 8466 8651 8838 9027 9218 9411 9606
  305.  
  306. Columns 100 through 101
  307.  
  308. 9803 10002
  309.  
  310. >> plot(x,y)
  311. >>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement