Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. y=x^2*sin(x);
  2. deff('y=f(x)',['y=(x^2)*sin(x)'])
  3. x=[-5:0.1:5]
  4. fplot2d(x,f)
  5.  
  6. deff('y=f(x)',['y=1/(1+%e^(1*x))'])
  7. fplot2d(x,f)
  8. deff('y=f(x)',['y=1/(1+%e^(2*x))'])
  9. fplot2d(x,f)
  10. deff('y=f(x)',['y=1/(1+%e^(3*x))'])
  11. fplot2d(x,f)
  12.  
  13. x=[0:0.1:1]
  14. deff('y=f(x)',['y=x+1'])
  15. fplot2d(x,f)
  16.  
  17. t=[0:0.1:2*%pi]
  18. polarplot(t,5*sin(3*t))
  19.  
  20. linear
  21.  
  22. A=[1 2 4 -1;0 1 2 0;3 1 1 -2]
  23. b=[21;8;16]
  24. C=[A b]
  25.  
  26. A=[1 2 1;1 1 0;2 1 -1]
  27. b=[3;3;3]
  28. C=[A b]
  29.  
  30. c=[1 2 1;1 1 0;2 1 -3]
  31. d=[3;3;3]
  32. rank(c)
  33. rank([c d])
  34.  
  35. poly
  36.  
  37. a=[10 5 -7 20]
  38. b=[-3 12 4]
  39. A=poly(a,'x','coeff')
  40. B=poly(b,'x','coeff')
  41. horner(A*B,3)
  42.  
  43. a=[2 -4 3 1]
  44. b=[2 0 1]
  45. A=poly(a,'x','coeff')
  46. B=poly(b,'x','coeff')
  47. pdiv(A,B)
  48.  
  49. a=input("Enter the coefficients of function 1:");
  50. b=input("Enter the coefficients of function 2:");
  51. p1=poly(a,'x','coeff');
  52. p2=poly(b,'x','coeff');
  53. r1=roots(p1);r2=roots(p2);
  54. disp("The first function is:")
  55. disp(p1);
  56. disp("and its root/s is/are:")
  57. disp(r1);
  58. disp("The second function is:")
  59. disp(p2);
  60. disp("and its root/s is/are:")
  61. disp(r2);
  62.  
  63. a=input("Enter the coefficients of function 1:");
  64. b=input("Enter the coefficients of function 2:");
  65. p1=poly(a,'x','coeff');
  66. p2=poly(b,'x','coeff');
  67. sum=p1+p2
  68. diff=p1-p2
  69. disp("The sum is:")
  70. disp(sum);
  71. disp("The difference is:")
  72. disp(diff);
  73.  
  74. stat
  75.  
  76. x=input("Enter an array=>");
  77. a=mean(x)
  78. b=stdev(x)
  79. disp("mean");
  80. disp(a);
  81. disp("The standard deviation:");
  82. disp(b);
  83.  
  84.  
  85. [a,b]=reglin(x,y)
  86. w=[b a]
  87. z=poly(y,"x","coeff")
  88. r=correl(x,y)
  89. x=[3 5 4 3 1]
  90. y=[15 26 28 29 1]
  91.  
  92. [a,b]=reglin(x,y)
  93. w=[b a]
  94. z=poly(w,"x","coeff")
  95. r=correl(x,y)
  96. x=[2 4 6 8 10]
  97. y=[15 20 25 30 35]
  98.  
  99. function[k]=set(x,y);
  100. [a,b]=reglin(x,y)
  101. k=plot(x,y,'r', k,a*x+b,'y')
  102. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement