Question
what is a good matlab code to out put this matrix from question 1 to 3
HITA 1)-The general form cf the quadratic equation is a +bx+c 0 Wrte a MATLAB function named quadratic that finds the two roo
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

function qudratic()
%to solve qudratic equation of ax^2+bx+c+0

clc;
clear;
fprintf('TO solve qudratic eqauation in the form ax^2+bx+c+0\n');
a=input('enter value of a\n');
b=input('enter value of b\n');
c=input('enter value of c\n');
x1=(-b+(b^2-4*a*c)^0.5)/(2*a);
x2=(-b-(b^2-4*a*c)^0.5)/(2*a);

fprintf('roots of the equation are x1= %f+%fi, x2=%f+%fi\n',x1,imag(x1),x2,imag(x1));   

end

2)

%to generaate random matrix with 6 rows 3 coloum using rand()
%rand(no of rows,no of column)
matrixA=rand(6,3);
fprintf('%d %d %d \n',[matrixA]);

3)

function matrixqudratic()
%to solve qudratic equation of ax^2+bx+c+0
%values are given by a random matrix

clc;
clear;

A=rand(6,3);


for i=1:6
output(i,1)=(-A(i,2)+(A(i,2)^2-4*A(i,1)*A(i,3))^0.5)/(2*A(i,1));

output(i,2)=(-A(i,2)-(A(i,2)^2-4*A(i,1)*A(i,3))^0.5)/(2*A(i,1));

end
output %display result

end

Add a comment
Know the answer?
Add Answer to:
what is a good matlab code to out put this matrix from question 1 to 3...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT