How can i Product Mathematical functions ?

1 visualización (últimos 30 días)
Hamed Pourjavadi
Hamed Pourjavadi el 24 de Abr. de 2019
Editada: Matt J el 24 de Abr. de 2019
Hi
Dear Users
i want to find all comlex roots of a function with Muller method and want to make a code for general functions f(x). first of all i dont know how many roots we have.
i wrote a code for muller method and it just find 1 root. suppose i introduce my function as:
f= @(x) x^2+x+1 % just an axample
suppose first root is r1 and for finding other roots i need to divide f in x-r1 so need introduce another function like g=f/(x-r1) and solve g(x).
i dont know how many roots we have and need to make new function after finding new root.
For example if second root is r2, i need to introduce h=f/(x-r1)* (x-r2) and etc.
i need to make a loop to make new functions after finding new roots
how can i do this work?
best regards
-Hamed

Respuesta aceptada

Matt J
Matt J el 24 de Abr. de 2019
Editada: Matt J el 24 de Abr. de 2019
f= @(x) x^2+x+1;
for i=1:N
r(i)=_______;
f=@(x) f(x)./(x-r(i));
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by