How to plot multivariable functions against each other?
2 views (last 30 days)
Show older comments
Max Springer
on 19 Jun 2018
Answered: Star Strider
on 19 Jun 2018
Have defined to functions based on biological mechanisms and am trying to plot the two against each other (GF on the x-axis, ECM on y-axis) where the variables in the equations (x and y) are the possible concentrations of the molecules which are reactants. The rest of the constants are defined. For some reason I cannot find a way to plot them?
% Variable Initialization
x = linspace(0,10);
y = linspace(0,10);
% Parameters
v2fak = 0.05; v1fak = 0.04; k2fak = 0.1; k1fak = 0.1; fakt = 1;
kagf = 0.1; kdap1 = 0.15; vs2ap1 = 0.05; kafak = 0.1; vsap1 = 0.05;
GF = [kagf * (kdap1 * x - vs2ap1 * (y / (kafak + y)))] / [vsap1 + vs2ap1 * ...
(y / (kafak + y)) - kdap1 * x];
ECM = (v2fak / v1fak) * (y / (k2fak + y)) * (k1fak + (fakt - y)) / ...
(fakt - y) - [kagf * (kdap1 * x - vs2ap1 * (y / (kafak + y)))] / [vsap1 + vs2ap1 * ...
(y / (kafak + y)) - kdap1 * x];
plot(GF,ECM);
0 Comments
Accepted Answer
Star Strider
on 19 Jun 2018
Vectorize all the vector multiplications and divisions, and it works:
GF = (kagf * (kdap1 * x - vs2ap1 * (y / (kafak + y)))) ./ (vsap1 + vs2ap1 * ...
(y / (kafak + y)) - kdap1 * x);
ECM = (v2fak / v1fak) * (y ./ (k2fak + y)) .* (k1fak + (fakt - y)) ./ ...
(fakt - y) - (kagf * (kdap1 * x - vs2ap1 * (y ./ (kafak + y)))) ./ (vsap1 + vs2ap1 * ...
(y ./ (kafak + y)) - kdap1 * x);
Also, use parentheses instead of square brackets unless you intend to define matrices with individual elements.
0 Comments
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!