In: Electrical Engineering
ExAMPLE)
How to solve the value of x for the equation 2x^4+x=18.
Ans)
Yes it's easier when we creat create a vector of its coefficients and use the roots function:
Program:-
% 2x^4+x=18 -> 2x^4 + x -18 = 0
coefvct = [2 0 0 1 -18]; % Coefficient
Vector
x =
roots(coefvct)
% Solution
Produces:-
x =
-1.7732e+000 + i
41.6666e-003 + 1.7326e+000i
41.6666e-003 - 1.7326e+000i
1.6899e+000 + i
Two real and two complex roots,
2nd example)
2x^4+x=C
C=20,22,24,26,28,30........50
Now, how to find x value at different C values.
Program-
The loop is easiest way:-
C =
[20:2:50];
% Define ‘C’
X = nan(4,
length(C));
% Preallocate ‘X’
for k1 = 1:length(C)
X(:,k1) = roots([2 0 0 1
-C(k1)]); % Coefficient
Matrix
end
The ‘X’ matrix is a (4x16) array with each column the coefficients corresponding the the same element in ‘C’.
PLZ HIT THE LIKE SYMBOLE.....