Solve non linear equations system
Afficher commentaires plus anciens
Hi, I'm a newbie, I have never used Matlab but I have to use it to solve a complex problem as a part of a modelisation project. I need to solve 4 non linear equation systems, each one is a 2 equations system with two variables (x and y) and t is a constant. I would like to get the results for x and y depending on t. I have some boundaries conditions, 6.3*10^10>x>0, 6.3*10^10>y>0 and 300>t>0. One of my 4 system for example:
0=(10^(-41)*(10^9)*(e^((1-2*0.2)*160)-1))/(1-2*0.2)-((e^(-160)-1)/(0.2*(1-0.2)))*(0.91-0.35*(((12.6*10^(11)-t*y)^2-(12.6*10^11-t*x-t*y)^2)/(12.6*10^11-t*x-t*y)^2)-25/(12.6*10^11-t*y)-(x+y)*2*t*0.35*(((12.6*10^11-t*y)^2)/(12.6*10^11-t*x-t*y)^3))+(e^(-0.2*160)-1)/0.2*(-0.91*t+0.35*(2*(t^2)*x*(12.6*10^11-t*x-t*y)+(t^3)*(x^2))/((12.6*10^11-t*x-t*y)^2)-(25*t)/(12.6*10^11-t*y))
0=(2.7*10^(-23)*(e^((1-2*0.2)*90)-1))/(1-2*0.2)-((e^(-90)-1)/(0.2*(1-0.2)))*(0.91-0.79*(((12.6*10^(11)-t*x)^2-(12.6*10^11-t*y-t*x)^2)/(12.6*10^11-t*y-t*x)^2)-42/(12.6*10^11-t*x)-(y+x)*2*t*0.79*(((12.6*10^11-t*x)^2)/(12.6*10^11-t*y-t*x)^3))+(e^(-0.2*90)-1)/0.2*(-0.91*t+0.79*(2*(t^2)*y*(12.6*10^11-t*y-t*x)+(t^3)*(y^2))/((12.6*10^11-t*y-t*x)^2)-(42*t)/(12.6*10^11-t*x))
Could you please help me to use Matlab in order to solve my problem? Thank you very much
Réponse acceptée
Plus de réponses (1)
Krisda
le 16 Fév 2023
0 votes
function [F] = fun_t(a,t)
x = a(1);
y = a(2);
e = exp(1);
F = zeros(2,1);
F(1) = (10^(-41)*(10^9)*(e^((1-2*0.2)*160)-1))/(1-2*0.2)-((e^(-160)-1)/(0.2*(1-0.2)))*(0.91-0.35*(((12.6*10^(11)-t*y)^2-(12.6*10^11-t*x-t*y)^2)/(12.6*10^11-t*x-t*y)^2)-25/(12.6*10^11-t*y)-(x+y)*2*t*0.35*(((12.6*10^11-t*y)^2)/(12.6*10^11-t*x-t*y)^3))+(e^(-0.2*160)-1)/0.2*(-0.91*t+0.35*(2*(t^2)*x*(12.6*10^11-t*x-t*y)+(t^3)*(x^2))/((12.6*10^11-t*x-t*y)^2)-(25*t)/(12.6*10^11-t*y));
F(2) = (2.7*10^(-23)*(e^((1-2*0.2)*90)-1))/(1-2*0.2)-((e^(-90)-1)/(0.2*(1-0.2)))*(0.91-0.79*(((12.6*10^(11)-t*x)^2-(12.6*10^11-t*y-t*x)^2)/(12.6*10^11-t*y-t*x)^2)-42/(12.6*10^11-t*x)-(y+x)*2*t*0.79*(((12.6*10^11-t*x)^2)/(12.6*10^11-t*y-t*x)^3))+(e^(-0.2*90)-1)/0.2*(-0.91*t+0.79*(2*(t^2)*y*(12.6*10^11-t*y-t*x)+(t^3)*(y^2))/((12.6*10^11-t*y-t*x)^2)-(42*t)/(12.6*10^11-t*x));
end
t = 5; %some value you want
func = @(a)fun_t(a,t)
x0 = [10,10]; % a guess for the solution
x = fsolve(func,x0);
lb = [0,0];
ub = [6.3*10^10,6.3*10^10];
rng default
x0 = [10,10];
[x res] = lsqnonlin(func,x0,lb,ub)
Catégories
En savoir plus sur Structural Mechanics 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!