How do you separate the roots of a function?
Mostra commenti meno recenti
For example, I wrote the following:
% a b c and d are input from the user
qx = [a b c d]; %a*x^3 + b*x^2 + c*x + d
derivative_qx = [3*a 2*b c]; %3*a*x^2 + 2*b*x + c
r = roots(derivative_qx);
disp(r);
If there are two roots how do I obtain the value of each separately so they are assigned to two different variables, such as r1 and r2. I was only able to find the roots function searching around, which displays both together.
Thanks
1 Commento
Ahsan
il 15 Ott 2014
Risposta accettata
Più risposte (1)
Andrei Bobrov
il 15 Ott 2014
qx = input('input as double array [1 x 4] = ');
dq = polyder(qx);
r = roots(dq);
use r(1) as r1 and r(2) as r2
1 Commento
Manoj
il 22 Apr 2018
% q1 %% Section 1a % Define crank length a=1;b=2;c=4;d=5;theta2=30; % Define input parameters and anonymous functions x1=120;xu=165;xi=120;xi_1=110;delta=0.01;precision=0.0001; f= % Student can choose one of these methods, all works % nr = newraph(f, df, xi, precision); % sc = secant(f, xi, xi_1, precision); % ms = modisecant(f, xi, pert, precision); % fzv = fzero(f, xi); % fzb = fzero(f, [xl, xu]);
%
%% Section 1b
% Define crank length
% Define input parameters for function
% Solve for root, for all ang2
% Plot the relation between the input angles and the output angles
%% Section 1C
%% Section 1D
% Write the result into text file
Categorie
Scopri di più su Whos in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!