Advertisement
Guest User

matlabutb

a guest
Nov 21st, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. 1)
  2.  
  3. A=[3 7 15; 2 4 7;7 -2 9]
  4. B=[19; 11; 13]
  5. x = A\B
  6. v1 = [5 3 7 8 11 13 9 17 4 2]
  7. v2 = round(rand(10,1)*16+3)
  8. vs=v1.*v2'
  9. ss=dot(v1,v2')
  10. v3 = [v1 v2']
  11. v3(3:11)
  12. v3(4:end)
  13. v3([2 7 12])
  14. M=diag(v1)
  15. det(M)
  16. trace(M)
  17.  
  18. ------------------------------------------
  19. 2)
  20. subplot(2,1,1);
  21. x=10:10:1000;
  22. y=3*log(x);
  23. plot(x,y,'--r')
  24. xlabel('Osa x')
  25. ylabel('Osa y')
  26. title('Prubeh funkce y=3ln(x)')
  27. grid on
  28. legend('y')
  29. subplot(2,1,2);
  30. [x,y]=meshgrid([-3.1:0.1:3.1]);
  31. z=3*sin(2*x.*y)-2*cos(3*x.*y);
  32. plot3(x,y,z)
  33. colormap autumn
  34. view(-65,35)
  35. grid off
  36. -------------------------------------------------------
  37. 3)
  38. h=get(handles.listbox1,'Value');
  39. r=str2num(get(handles.edit1,'String'))
  40. v=str2num(get(handles.edit2,'String'))
  41.  
  42. switch h
  43.  
  44. case 1
  45. o=2*pi*r;
  46. q1='Obvod kružnice je:'
  47. q2=num2str(o)
  48.  
  49. case 2
  50. o=pi*r.^2;
  51. q1= 'Obsah kruhu je:'
  52. q2=num2str(o)
  53.  
  54. case 3
  55. o=pi*(r.^2)*v
  56. q1='Objem valce je:'
  57. q2=num2str(o)
  58.  
  59. otherwise
  60. o=1;
  61. q1='Chyba je'
  62. q2=num2str(0)
  63.  
  64. end
  65. set(handles.text3,'String',q1)
  66. set(hanldes.edit3,'String',q2)
  67.  
  68. push button
  69. clear all
  70. clc
  71. close
  72.  
  73. --------------------------------------------------
  74. 2.
  75. figure
  76.  
  77. subplot(2, 1, 1);
  78. x = 10:1:1000;
  79. y = 3.*log(x)
  80. semilogx(x,y, '--r')
  81. grid on
  82. xlabel('osa x');
  83. ylabel('osa y');
  84. title('Prubeh funkce y = 3ln(x)');
  85. legend('y')
  86.  
  87. subplot(2, 1, 2);
  88. [x2, y2] = meshgrid(-3.1:0.1:3.1);
  89. z = 3.*sin(2*x2*y2) - 2.*cos(3*x2*y2)
  90. mesh(x2, y2, z)
  91. colormap autumn
  92. view(-65, 35)
  93. grid off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement