NONLINEAR EQUATIONS WITH FSOLVE

3 visualizaciones (últimos 30 días)
Angel Federico Miranda
Angel Federico Miranda el 20 de Abr. de 2018
Comentada: Star Strider el 20 de Abr. de 2018
Hello people, I would know how to obtain a vector of solution. I have 2 nonlinear function, and I need to obtain for each temperature two variable of solution; So in sum up , I need obtain a matrix with temperatures and 2 solution variables. Thanks!!!

Respuesta aceptada

Star Strider
Star Strider el 20 de Abr. de 2018

I have no idea what your function is. You can do something like this:

T = linspace(270, 300, 10);                             % Create Temperature Vector
p0 = [1; 1];                                            % Initial Parameter Estimates (Column Vector)
fcn = @(p,T) (p(1)*T.^2 - p(2)*T - 10);                % Create Function With Two Parameters
for k1 = 1:numel(T)
    P(:,k1) = fsolve(@(p)fcn(p,T(k1)), p0);             % Solve & Store Results For Each Value Of ‘T’
end
figure
plot(T, P)
grid
  4 comentarios
Angel Federico Miranda
Angel Federico Miranda el 20 de Abr. de 2018
Editada: Walter Roberson el 20 de Abr. de 2018
It worked, that was exactly what I needed. Thank you for your time, I really appreciate it!!!
Star Strider
Star Strider el 20 de Abr. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (1)

Torsten
Torsten el 20 de Abr. de 2018
Call fsolve in a loop for the different termperatures. Save the solutions of each run in a (2xn) matrix (n = number of temperatures).
Best wishes
Torsten.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by