Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Problem 1
- A = zeros(5);
- for p=1:5
- for q=1:5
- A(p,q) = (p*q^2*sin(3*p+q))/(3+p+3*q);
- end
- end
- %1.1
- b = [1; 1; 1; 1; 1];
- x = A\b;
- J1 = x(3);
- J1
- %1.2
- B = A^2 + pi*A;
- v = eig(3);
- J2 = sum(abs(v));
- J2
- %Problem 2
- syms x
- f = (x.^2+2*x-3)./(2+sin(x));
- d = diff(f,5);
- g = subs(d, x, 3);
- J3 = double(g);
- J3
- %Problem 3
- J4=integral(@(x)(x.^2+2*x-1)./(2+sin(x)), -1, pi)
- %Problem 4
- g = @(x, y)(sin(x.*y/3).^3).*x.^2.*y
- J5 = integral2(g, 0, pi/2, 1, 3)
- %Problem 5
- syms t;
- y = dsolve('D2y-4*Dy+3*y=cos(3*t/4)', 'y(0) = 0', 'Dy(1) = 0');
- s=subs(y, t, 3/10);
- J6=double(s);
- J6
- %Problem 6
- ezplot('(sin(x)+3*cos(x)/5)/(3/15+x)', [0,2*pi])
- [x,y]=fminbnd(@(x)(sin(x)+3*cos(x)/5)/(3/15+x), 3, 5);
- J7 = y
- %Problem 7
- ezsurf('x*exp(-x^2 - (y^4)/4)')
- [x, y] = fminsearch('x(1)*exp(-x(1)^2 - (x(2)^4)/3)', [-0.5, 0.5]);
- J8 = y
- %Problem 8
- C = [ones(1,10), -sin(3)];
- z=roots(C)
- J9 = sum(z.^3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement