Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- syms x T;
- assume (x ~= -1);
- figure(1)
- title("Função")
- axis([-5 4 -10 50])
- fplot(f(x))
- figure(2)
- title("É par ou ímpar")
- axis([-5 4 -10 50])
- hold on
- par = logical(f(x) == f(-x)) %0 false, 1 true
- impar = logical(-f(x) == f(-x)) %0 false, 1 true
- fplot(f(x) - f(-x))
- fplot(f(x) + f(-x))
- fplot(0, 'LineStyle', '- -')
- hold off
- [periodo, ~, conditions] = solve(f(x + T) - f(x) == 0, x, 'ReturnConditions',true) %if returns with no conditions then
- figure(3)
- title("Zeros")
- hold on
- zeros = solve(f(x) == 0)
- axis([-1 1 -1 1])
- fplot(f(x))
- fplot(0)
- for zero = zeros
- scatter(zero, 0)
- end
- hold off
- figure(4)
- title("Zeros")
- hold on
- zeros = solve(f(x) == 0)
- axis([-5 4 -10 50])
- fplot(f(x))
- fplot(0)
- for zero = zeros
- scatter(zero, 0)
- end
- hold off
- figure(5)
- title("Assíntotas")
- axis([-20 20 -2 14])
- hold on
- fplot(f(x))
- limiteNaDescontinuidade = limit(f(x), x, -1) %Se +-Inf, ent x = -1 é uma assintota vertical
- xline(-1, 'b')
- %Assíntotas horizontais e oblíquas
- m = limit(f(x)/x, x, inf);
- assintota1 = limit(f(x) - m*x, x, inf)
- fplot(assintota1)
- m = limit(f(x)/x, x, -inf);
- assintota2 = limit(f(x) - m*x, x, -inf)
- %aqui a assintota1 = assintota2 portanto não é preciso desenhar essa segunda
- legend('y = f(x)', 'x = -1', 'y = 2')
- hold off
- figure(6)
- title("Derivadas")
- hold on
- axis([-5 4 -10 20]);
- l = axis;
- derivada1 = diff(f(x))
- derivada2 = diff(derivada1)
- fplot(f(x))
- fplot(derivada1, 'r')
- fplot(derivada2, 'b')
- zerosD1 = solve(derivada1 == 0, x);
- for zero = zerosD1
- scatter(zero, 0, 'r')
- end
- zerosD2 = solve(derivada2 == 0, x);
- for zero = zerosD2
- scatter(zero, 0, 'b')
- end
- fplot(0, 'LineStyle', '- -')
- legend('y = f(x)', "y = f'(x)", "y = f''(x)")
- ylD2 = l(3)+8;
- ylD1 = l(3)+5;
- ylD0 = l(3)+2;
- ylD0D1 = ylD0+0.5;
- ylD0D2 = ylD0-0.5;
- text(l(2), ylD2 , "f''");
- text(l(2), ylD1, "f'");
- text(l(2), ylD0 , "f");
- mid = (l(1) + -1)/2;
- text(mid, ylD1, '+')
- text(mid, ylD0D1, '↗')
- text(mid, ylD2, '+')
- text(mid, ylD0D2, '◡')
- text((-1 + zerosD1)/2, ylD1, '-')
- text((-1 + zerosD1)/2, ylD0D1, '↘')
- text((-1 + zerosD2)/2, ylD2, "+")
- text((-1 + zerosD2)/2, ylD0D2, "◡")
- text(zerosD1, ylD1, '0')
- text(zerosD1-0.1, ylD0D1, num2str(double(f(zerosD1))))
- text((zerosD1 + l(2))/2, ylD1, "+")
- text((zerosD1 + l(2))/2, ylD0D1, '↗')
- text(zerosD2, ylD2, "0")
- text(zerosD2, ylD0D2, num2str(double(f(zerosD2))))
- text((zerosD2 + l(2))/2, ylD2, "-")
- text((zerosD2 + l(2))/2, ylD0D2, "◠")
- hold off
- function y = f(x)
- y = (2*(x ^ 2) + x) /((x + 1)^2);
- end
Add Comment
Please, Sign In to add comment