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

조회 수: 1 (최근 30일)
Emilie M
Emilie M 2017년 6월 18일
댓글: Emilie M 2017년 6월 19일
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
John D'Errico
John D'Errico 2017년 6월 19일
편집: John D'Errico 2017년 6월 19일
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 2017년 6월 19일
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.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by