Написание системы функций общего равновесия

#matlab #math #newtons-method

#matlab #математика #метод Ньютона

Вопрос:

Я пытаюсь создать систему уравнений с теоретически, которые представляют функции, показанные ниже (мы знаем Kt, alpha и beta, но не Kt q) — любая помощь приветствуется:

Изображение системы уравнений

Как я должен представить это и передать его в мой код Ньютона Рафсона (любой ввод здесь также приветствуется):

 % newton raphson 
function I = NR(f,x0) 
    x=x0; %starting point 
    fx=f(x);  
    J = CDJac(f,x); 
    I = x - fx/J;     
end 

% the jacobian below is validated;

function [DCD] = CDJac(f,xbar)%the jacobian 
    jk=length(xbar); %find the dimension of x
    hstar=eps^(1/3); %choose value of h based upon Heer and Maussner machine eps
    e=zeros(1,jk); %1 x j vector of zeros; j coresspond to the derivative 
    %with respect to the jth varibale. If j=1, I am taking the derivative of
    %this multivraite function with respect to x1. Creates a bunch of zeros. AS
    %we go through and evlaute everything. We replace that zeros with a one. 
    for j=1:length(xbar) %if j is 1:10. xbar is the vector of 
         different points. you have 10 differetn x s. 
        e(j)=1; %replace the jth entry to 1 in the zero vector. (1,0). In a 
        %of loop, j become 2 after it is done with 1. We then take the second
        %element of it and change it to a 1- (0,1). 
        fxbarph=f([xbar e.*hstar]); %function evaluated at point xbar plus h
        fxbarmh=f([xbar-e.*hstar]); %function evaluated at point xbar minus h
        DCD(:,j)=(fxbarph-fxbarmh)./(2*hstar);
        e=zeros(1,jk); %create the ej row vector of zeros. For instance, when j
        %goes to 2, you need to have 0s everywhere except the second column. 
    end
end
  

Ответ №1:

Я думаю, вам нужно выполнить следующие шаги:

  1. Выразите каждую функцию как f (k) = 0: вычтите RHS из обеих частей каждого уравнения.
  2. Вычислите якобин для линейных приращений: J * dk = f
  3. Сделайте первоначальное предположение для неизвестного k-вектора
  4. Решите для неизвестного вектора приращения dk
  5. Обновите вектор k: k(новый) = k(старый) dk
  6. Итерация к сходимости