Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %IFPB, 07/06/17
- %PGM Resolução de Equação do 2o grau
- clc, clear all, close all, help eq2grau
- a = input('Digite a: ');
- b = input('Digite b: ');
- c = input('Digite c: ');
- x1 = (-b - sqrt(b^2-4*a*c)) /(2*a);
- x2 = (-b + sqrt(b^2-4*a*c)) /(2*a);
- STR = sprintf('As raizes valem: x1 = %2.4g e x2 = %2.4g', x1, x2);
- disp (STR)
- x = -3 : 0.1 : 5;
- y = a.*x.^2+b.*x+c;
- fig=figure(1)
- set(fig,'Position', [1 41 1920 964], 'color', [1 1 1]);
- ax = axes;
- set(ax,'fontsize', 20);
- graf = plot(x,y,'k-');
- set (graf, 'LineWidth',3);
- xlabel('x');
- ylabel('y');
- title('PARABOLA');
- legend('Curva da Parabola',4);
- grid on;
- axis square;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement