Solving a System of Equations

2 vues (au cours des 30 derniers jours)
Konstantinos
Konstantinos le 11 Nov 2013
Commenté : Walter Roberson le 11 Nov 2013
I am experiencing difficulties in solving the following system of equations: Υ=Χ+Α-Β*e^(-Χ/6), Υ= -10log[10^(1.76)-10^(-X/10)], where A and B are parameters defined by the user (i.e A=5, B=4). Any help could be useful. Thanks in advance!

Réponse acceptée

Walter Roberson
Walter Roberson le 11 Nov 2013
You will need to solve this numerically. Subtract one from the other, numerically solve for a 0. Along the way you will need to decide if you are wanting natural logs or log10 .
Caution: this is pretty sensitive numerically, especially near X = -17.6
  2 commentaires
Konstantinos
Konstantinos le 11 Nov 2013
************************************************************************
clc;
clear all;
fprintf('This program solves the system of equations which have the following form:\nY=X+A-Be^(-X/6)\nY=-10*log[10^(1.76)-10^(-X/10)]\n')
syms OBO IBO
[IBO1,OBO1]=solve('OBO=IBO+6-6*exp(IBO/6)','10^(-IBO/10)+10^(-OBO/10)=10^1.76') ********************************************************************** this peace of code works and gives me the necessary results because I set A=6 , B=6. The problem appears when I want the user to set A and B. To achieve this i use the following lines: ************************************************************************
clc;
clear all;
fprintf('This program solves the system of equations which have the following form:\nY=X+A-Be^(-X/6)\nY=-10*log[10^(1.76)-10^(-X/10)]\n')
syms OBO IBO
syms A B
A=input('Enter the value of the variable A: ');
B=input('Enter the value of the variable B: ');
[IBO1,OBO1]=solve('OBO=IBO+A-B*exp(IBO/6)','10^(-IBO/10)+10^(-OBO/10)=10^1.76') ***********************************************************************************
Walter Roberson
Walter Roberson le 11 Nov 2013
eqn1 = sym('OBO=IBO+A-B*exp(IBO/6)');
eqn2 = sym('10^(-IBO/10)+10^(-OBO/10)=10^1.76');
sA = sym('A');
sB = sym('B');
seqn1 = subs(eqn1, {sA, sB}, {A, B});
seqn2 = subs(eqn2, {sA, sB}, {A, B});
solve(seqn1, seqn2)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by