Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. %Problem 1
  2. A = zeros(5);
  3. for p=1:5
  4. for q=1:5
  5. A(p,q) = (p*q^2*sin(3*p+q))/(3+p+3*q);
  6. end
  7. end
  8.  
  9. %1.1
  10. b = [1; 1; 1; 1; 1];
  11. x = A\b;
  12. J1 = x(3);
  13. J1
  14.  
  15. %1.2
  16. B = A^2 + pi*A;
  17. v = eig(3);
  18. J2 = sum(abs(v));
  19. J2
  20.  
  21. %Problem 2
  22. syms x
  23. f = (x.^2+2*x-3)./(2+sin(x));
  24. d = diff(f,5);
  25. g = subs(d, x, 3);
  26. J3 = double(g);
  27. J3
  28.  
  29. %Problem 3
  30. J4=integral(@(x)(x.^2+2*x-1)./(2+sin(x)), -1, pi)
  31.  
  32. %Problem 4
  33. g = @(x, y)(sin(x.*y/3).^3).*x.^2.*y
  34. J5 = integral2(g, 0, pi/2, 1, 3)
  35.  
  36. %Problem 5
  37. syms t;
  38. y = dsolve('D2y-4*Dy+3*y=cos(3*t/4)', 'y(0) = 0', 'Dy(1) = 0');
  39. s=subs(y, t, 3/10);
  40. J6=double(s);
  41. J6
  42.  
  43. %Problem 6
  44. ezplot('(sin(x)+3*cos(x)/5)/(3/15+x)', [0,2*pi])
  45. [x,y]=fminbnd(@(x)(sin(x)+3*cos(x)/5)/(3/15+x), 3, 5);
  46. J7 = y
  47.  
  48. %Problem 7
  49. ezsurf('x*exp(-x^2 - (y^4)/4)')
  50. [x, y] = fminsearch('x(1)*exp(-x(1)^2 - (x(2)^4)/3)', [-0.5, 0.5]);
  51. J8 = y
  52.  
  53. %Problem 8
  54. C = [ones(1,10), -sin(3)];
  55. z=roots(C)
  56. J9 = sum(z.^3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement