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
what is a good matlab code to out put this matrix from question 1 to 3...
MATLAB QUESTION !!! PLEASE USE MATLAB FOR BOTH
QUESTIONS!!! THANKS
3) Below is a matrix of random numbers. Find the mean, median, and mode of the matrix. B=[0 1 2 3 4 50689 23092 6 8 407] Sort Matrix Z so that the largest numbers of each row are in the first column and smallest numbers descend towards the last column. Must use sort function. 4) Create a matrix X so that the first row has values from 0 to...
1. Write a MATLAB function that takes a matrix, a row number and
a scalar as
arguments and multiplies each element of the row of the matrix by
the scalar returning the
updated matrix.
2. Write a MATLAB function that takes a matrix, two row numbers and
a scalar as
arguments and returns a matrix with a linear combination of the
rows. For example, if the rows
passed to the function were i and j and the scalar was m,...
use matlab and show all codes and work
the question continues from this
4. Write a function with header (A, V - myCone (r, h), which outputs the total area A and volume of a cone with base radius r and height h. 5. Write a function - myMatrix (myvec, m, n) which creates an m-by-n matrix A, as in Problem 3, but for arbitrary values of mand n and any length of vector myvec. Hint: the function can use...
cope the code please
thanks
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...
Question:Matrix Notation Interpreter (matrix elements to cell
array of formatted character vectors)
Matlab question
Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) A system of linear algebraic equations can be writen in matrx notation by applying the definizion of matrix multiplication. For example, the linear system Can be writen as or where and x = 2 matrix input ror the variable A and a × T e function command dennes the output variable linearSystem Code has...
Please show me the MATLAB CODE for this problem Thank you Write programs that determine solutions for polynomials (quadratics, et al) a) Create a program that presumes the user-entered values (a,b,c) represent a valid quadratic equation and your initial program simply solves the equation and reports the real or imaginary roots. b) Create a flowchart that describes all possible combinations of user entered data, e.g. perhaps a user enters (1, 0, -4) as (a, b, c) which is of course...
Using matlab and if/else statement please!
Write a function that determines the real roots of a quadratic equation ax2 + bx + c = 0. To calculate the roots of the equation, the function calculates the discriminant D, given by: D = b2-4ac If D> 0, the code should display "The equation has two roots" and print the values on a new line. If D 0, the code should display "The equation has one root.", and print the value on...
problem2, the file "Test_Data.xlsx" contains in
cylinder pressure data from a firing engine. the data is resolved
in crank angle degree and is taken every 1/2 degree.
O tittps/ualearn blackboard.com/bbcswebdav/pid plot a new function on the same graph overwriting the orizinal function 1 of11ρ Functions to choose from: y A sin(Bx C)+ D y A sin2(Bx+ C) + D y A In(Bx + C)D y A exp(Bx + C)+ D ž. The file "Test Data.xlsx" contains in-cylinder pressure data from...
A quadratic equation is generally represented as, ax^2 + bx + c The root(s) of the above quadratic equation is computed using the following formula, root1 = (-b + sqrt(D))/ 2a root2 = (-b - sqrt(D))/2a Where D is the discriminant of the quadratic equation and is computed as, D = b^2 - 4ac Given the value of D, the roots of a quadratic equation can be categorized as follows, D > 0 : Two distinct real roots D =...
MATLAB HELP!!! Recall that if A is an m × n matrix and B is a p
× q matrix, then the product C = AB is defined if and only if n =
p, in which case C is an m × q matrix.
5. Recall that if A is an mx n matrix and B is a px q matrix, then the product C-AB is defined if and only if n = p, in which case C is...