Advertisement
BORUTO-121

quadartic_function(16)

Mar 6th, 2022
163
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [x1,x2]=f(1,0,25)
  2. function [x1,x2]=f(a,b,c)
  3.     D=b*b-4*a*c;
  4.     %%No real solutions
  5.     if(D<0)
  6.         x1=(-b+sqrt(-D)*i)/(2*a);
  7.         x2=(-b-sqrt(-D)*i)/(2*a);
  8.         %%x=-10:0.1:10;
  9.     elseif(D==0)
  10.         x1=-b/(2*a);
  11.         x2=x1;
  12.         %%x=-10+x1:0.1:10+x1;
  13.     else
  14.         x1=(-b+sqrt(D))/(2*a);
  15.         x2=(-b-sqrt(D))/(2*a);
  16.         %%x=-10+x2:0.1:10+x1;
  17.     end
  18.     x=-10:0.01:10;
  19.     y=a*x.*x+b*x+c;
  20.     plot(x,y);
  21.     axis([-10 10 -20 20])
  22. end
Advertisement
RAW Paste Data Copied
Advertisement