1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Veronika [31]
3 years ago
15

Write a MATLAB program to solve for the roots of a quadratic equations, regardless of type. Use complex variables so that no bra

nches will be required based on the value of the discriminant. g
Computers and Technology
1 answer:
slavikrds [6]3 years ago
5 0

Explanation:

PROGRAM  QuadraticEquation

  IMPLICIT  NONE

  REAL  :: a, b, c

  REAL  :: d

  REAL  :: root1, root2

   

!  read in the coefficients a, b and c

  READ(*,*)  a, b, c

  WRITE(*,*) 'a = ', a

  WRITE(*,*) 'b = ', b

  WRITE(*,*) 'c = ', c

  WRITE(*,*)

!  compute the square root of discriminant d

  d = b*b - 4.0*a*c

  IF (d >= 0.0) THEN            

     d     = SQRT(d)

     root1 = (-b + d)/(2.0*a)  

     root2 = (-b - d)/(2.0*a)

     WRITE(*,*)  'Roots are ', root1, ' and ', root2

  ELSE                          

     WRITE(*,*)  'no real roots exist!'

     WRITE(*,*)  'Discriminant = ', d

  END IF

END PROGRAM  QuadraticEquation

You might be interested in
After a conditional formatting rule is created using the ____ dialog box, the rule is then available for use in the database fro
Setler [38]

Answer:

New Formatting Rule.

Explanation:

Using New Formatting Rule the rule can be used in the database .Conditional formatting is used to highlight cells with different color according to the value of the cell. Conditional formatting can be done using formulas.In conditional formatting you can use if statements ,if else staements ,formulas etc.

5 0
3 years ago
#include
gavmur [86]

Answer:

See explaination

Explanation:

#include <fstream>

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

// Fill in the code to define payfile as an input file

ifstream payfile;

float gross;

float net;

float hours;

float payRate;

float stateTax;

float fedTax;

cout << fixed << setprecision(2) << showpoint;

// Fill in the code to open payfile and attach it to the physical file

// named payroll.dat

payfile.open("payroll.dat");

// Fill in code to write a conditional statement to check if payfile

// does not exist.

if(!payfile)

{

cout << "Error opening file. \n";

cout << "It may not exist where indicated" << endl;

return 1;

}

ofstream outfile("pay.out");

cout << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

outfile << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

// Fill in code to prime the read for the payfile file.

payfile >> hours;

// Fill in code to write a loop condition to run while payfile has more

// data to process.

while(!payfile.eof())

{

payfile >> payRate >> stateTax >> fedTax;

gross = payRate * hours;

net = gross - (gross * stateTax) - (gross * fedTax);

cout << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

outfile << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

payfile >> hours ;// Fill in the code to finish this with the appropriate

// variable to be input

}

payfile.close();

outfile.close();

return 0;

}

4 0
3 years ago
The man-in-the-middle attack<br> means what
Tom [10]

Answer:

<em> where the attacker secretly relays and possibly alters the communications between two parties who believe that they are directly communicating with each other.</em>

Explanation:

4 0
3 years ago
When the narrator of "EPIC 2015" describes the year 2015 as the "worst of
denpristay [2]

Answer:

A. computers will be replaced by new technology

3 0
3 years ago
Yooooooooooooooo
patriot [66]

Answer:

A-A Boolean search

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • What can be determined from this selection? Check all that apply. The Tax Info worksheet is currently being viewed. There are th
    6·2 answers
  • You have to communicate a signal in a language that has 3 symbols A, B and C. The probability of observing A is 50% while that o
    11·1 answer
  • Which of the following functions and expressions will convert the ASCII character "Z" to its numeric equivalent ASCII code?
    7·1 answer
  • Which of the following describes a BYOD?
    15·1 answer
  • A loop that repeats a specific number of times is known as a(n):
    9·1 answer
  • Webster defines risk as "the possibility of loss or injury". Therefore, driving a motor vehicle is a risk.
    12·1 answer
  • Which wireless communication is typically limited to six feet of distance?
    6·1 answer
  • Stephanie would like to know the average number of regular hours worked by her employees. In cell B11, create a formula using th
    8·1 answer
  • Which is an advantage of using a flat file instead of a relational database?
    9·1 answer
  • Why is the yellow light blinking on the front of my computer
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!