Azzera filtri
Azzera filtri

How to define a range of solutions and build a loop for a set of equations ?

1 visualizzazione (ultimi 30 giorni)
Hello,
I have 3 equations with 3 unknows: x, y, z.
The following code works
XA=0.4
XB=0.6
XC=0
IC50A=9456
IC50B=14.75
IC50C=7.602
syms x y z positive
eqn1 = XA.*x+(XA.*IC50A.*(y./IC50B+z./IC50C)) == x;
eqn2 = XB.*y+(XB.*IC50B.*(x./IC50A+z./IC50C)) == y;
eqn3 = XC.*z+(XC.*IC50C.*(x./IC50A+y./IC50B)) == z;
sol = vpasolve(eqn1,eqn2,eqn3,x,y,z)
s=[sol.x, sol.y, sol.z]
But, I have 2 questions:
1) How to define a loop in order to solve the equations for different set of XA, XB, XC: I wrote the code below, and I add the . before the * and /, but it does not work. Do you have any idea ?
data=xlsread('valuefractions.xlsx');
XA=data(:,1)
XB=data(:,3)
XC=data(:,2)
2) How to define a range of solutions for x, y and z ? I tried the code below, but it does not work too. Do you have any idea ?
setRange(x,19000,1000)
setRange(y,30,2)
setRange(z,15,1)
Thank you for your help.
  2 Commenti
John D'Errico
John D'Errico il 19 Giu 2017
Modificato: John D'Errico il 19 Giu 2017
Where did you find setRange? Why do you think it applies here? If you are just making up the name of a function, then why do you think that you can just make up some function name and expect it to work? Note that I know of on;y one function named setrange, and I wrote it, for a completely different application.
Emilie M
Emilie M il 19 Giu 2017
Hello, I found that here: https://www.mathworks.com/help/matlab/ref/matlab.io.hdf4.sd.setrange.html
It is written:
Set maximum and minimum range value for data set Syntax
setRange(sdsID,maxval,minval)
I am sorry, I am a beginner in Matlab, I am not used to defining functions.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by