how to Nonlinear equations?(two variables)

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 commentaire

darova
darova le 2 Mai 2020
Did you try something? I think you need fsolve and for loop. Solve equations for every t step

Connectez-vous pour commenter.

 Réponse acceptée

Are Mjaavatten
Are Mjaavatten le 2 Mai 2020
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 commentaires

semih kahraman
semih kahraman le 2 Mai 2020
I want to find i1 i2 i3 and want to plot their changes. with subplot
The correct expression for A is:
A = [14+R1(t(i)),-10,-4;-10,18+R2(t(i)),1;-4,-8,12];
If you use this in my code, then i1 = X(1,:) and so on. The plot command should give a plot of all three currents versus t. To see which is which:
legend('i1(t)','i2(t)','i3(t)','location','west');
xlabel t
Plotting them in separate subplots should be trivial.
semih kahraman
semih kahraman le 3 Mai 2020
thank you for your interest. I just started learning.what I want to do is print these three streams on different screens one after another. I want to do this with a subplot. at the same time, the initial values ​​of my i are 0. and t = 0: 0.01: 5.
and I want to find the average values ​​of these works.
thank you again for your interest.
figure;
subplot(311);
plot(t,X(1,:));
title(sprintf('I_1 Mean value:%f',mean(X(1,:))));
subplot(312);
plot(t,X(2,:));
title(sprintf('I_2 Mean value:%f',mean(X(2,:))));
subplot(313);
plot(t,X(3,:));
title(sprintf('I_3 Mean value:%f',mean(X(3,:))));
semih kahraman
semih kahraman le 3 Mai 2020
thank you so much sir

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by