NONLINEAR EQUATIONS WITH FSOLVE

조회 수: 3 (최근 30일)
Angel Federico Miranda
Angel Federico Miranda 2018년 4월 20일
댓글: Star Strider 2018년 4월 20일
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!!!

채택된 답변

Star Strider
Star Strider 2018년 4월 20일

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
Angel Federico Miranda
Angel Federico Miranda 2018년 4월 20일
편집: Walter Roberson 2018년 4월 20일
It worked, that was exactly what I needed. Thank you for your time, I really appreciate it!!!
Star Strider
Star Strider 2018년 4월 20일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2018년 4월 20일
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.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by