# how to Nonlinear equations?(two variables)

조회 수: 6 (최근 30일)
semih kahraman . 2020년 5월 2일
편집: semih kahraman . 2020년 5월 3일
f(1) = x(1)*(14+r1)-10*x(2)-4*x(3)-100;
f(2) = x(1)*-10+x(2)(18+r2)+x(3)*-8+80;
f(3) = x(1)*-4+x(2)*-8+x(3)*12-50;
how can I solve these nonlinear equations. There are rheostatic values so there is a second variable t. Should I write a function?eq
##### 댓글 수: 1표시 없음숨기기 없음
darova 2020년 5월 2일
Did you try something? I think you need fsolve and for loop. Solve equations for every t step

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

### 채택된 답변

Are Mjaavatten 2020년 5월 2일
Although R1 and R2 are nonlinear finctions of t, your equations are linear in x. So you write the equations on the form
A(t)*x = b and solve by x = A\b for every t of interest.
I suggest you define R1(t) and R2(t) as anonymous functions. Here is a template:
R1 = @(t) 5*t^2+10;
R2 = @(t) 2*exp(t)+5;
t = linspace(0,5);
b = [100;-80+8;50];
X= zeros(3,length(t));
for i = 1:length(t)
A = [3 by 3 matrix containing R1(t(i)) and R2(t(i))];
X(:,i) = A\b;
end
plot(t,X')
##### 댓글 수: 5표시 이전 댓글 수: 4숨기기 이전 댓글 수: 4
semih kahraman 2020년 5월 3일
thank you so much sir

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

### 카테고리

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

### Community Treasure Hunt

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

Start Hunting!