Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. a=1.6;
  2. x=1.2:0.5:3.7;
  3. myFunction=@(x)(a.^(x.*x-1) - log10(x.*x - 1) + (x.*x-1).^(1/3));
  4. hold on;
  5. plot(x,myFunction(x), 'o');
  6. fplot(myFunction,[1.28,1.36]);
  7. fplot(myFunction,[1.36,2.47]);
  8. fplot(myFunction,[2.47,3.68]);
  9. fplot(myFunction,[3.68,4.56]);
  10. legend("show");
  11. --------------------
  12. x = 1.0:0.01:2.0;
  13. function y =myFunction(x)
  14. y = (5-x).^(1/3) - x;
  15. endfunction
  16. y = myFunction(x);
  17. Zero = fzero(@myFunction, 0.5)
  18. plot(x,y);
  19. --------------
  20. x=1;
  21. function y =myFunction(x)
  22. y = x * (1 - x.*x).^(1/2);
  23. endfunction
  24. x=fminbnd(@myFunction,-1.0, 0)
  25. y=myFunction(x)
  26. ----------------------
  27.  
  28. x = [0.5;3.5];
  29. function z =myFunction(x)
  30. z = x(1)*x(1) + x(1)*x(2) + x(2)*x(2) - 3*x(1) - 6*x(2);
  31. endfunction
  32. [Min, funcMin]=sqp(x,@myFunction)
  33. ----------------
  34. ---------------
  35. x = 1.5:0.01:3.0;
  36. y = x.*x.*(1 + log(x));
  37. IntegrateTrapz = trapz(x, y)
  38.  
  39. function y = myFunction(x)
  40. y = x.*x.*(1 + log(x));
  41. endfunction
  42. [IntegrateSimpson] = quadv(@myFunction,1.5,3.0,0.0025)
  43. ----------------
  44. A=[1 2 5 -11; 2 -6 -3 8; 3 4 5 1; 7 6 2 20];
  45. B= [7;11;15;-9];
  46. SLE=A\B
  47. SLE2=mldivide(A,B)
  48. [eigenvectors,eigenvalues]=eig(A)
  49. det(A)
  50. ---------------
  51.  
  52. x = [-25 -23 -21 -18 -17.2 -15.4 -14];
  53. y = [0.76 0.74 0.61 0.58 0.84 0.92 1.22];
  54. p1 = polyfit(x, y, 1);
  55. p2 = polyfit(x, y, 5);
  56. p3 = polyfit(x, y, 7);
  57. XX = linspace(x(1), x(end), 100);
  58. y1 = polyval(p1, XX);
  59. y2 = polyval(p2, XX);
  60. y3 = polyval(p3, XX);
  61. plot(x, y, 's', XX, y1, XX, y2, XX, y3);
  62. legend ("show");
  63. ---------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement