MATLAB Answers

Scaling axes on plot

1 view (last 30 days)
Rick on 17 Sep 2014
Commented: Rick on 17 Sep 2014
I am trying to make plots that are the same as the two plots at the bottom of this page
For the very first plot (black), it has it basically at zero on my plot, but on the website the straight horizontal line is elevated
And I am having a problem with the second graph (green) at the bottom of the page because I don't have that straight line before the exponential decay.
For the third graph (blue), the scaling is not good which is why the line shoots straight up, instead of what the one on the website looks like
X = linspace(0,1,1000);
rA = (-10^-8)/3.*(X <= 0.5) + (-10^-8)./(3+10*(X-0.5)).*(X > 0.5);
f2 = @(x) 1./((-10^-8)./(3+10.*(x-0.5)));
for i = 1:numel(X)
if X(i) <= 0.5
V_PFR(i) = (-1000/(10^-8/3)*-0.5);
V_PFR(i) = (-1000/(10^-8/3)*-0.5) + -1000*integral(f2,0.5,X(i));
xlim([0 4.5e11])
title('r_{A} vs V_{PFR}')
xlim([0 4.5e11])
title('Conversion vs. V_{PFR}')

Accepted Answer

Adam on 17 Sep 2014
Edited: Adam on 17 Sep 2014
The first graph you can simply set:
ylim( [0 8e8] );
For the second graph you can just change the first value of V_PFR to 0 since it has a load of repeated values anyway:
V_PFR(1) = 0;
and plot as before.
The final graph suggests that the first 500 values of your V_PFR array should not be constant though. That appears to be more related to the maths than graph scaling. Solving that problem would also mean the second graph should be correct too without the need for the fudge described above.
if X(i) <= 0.5
V_PFR(i) = (-1000/(10^-8/3)*-0.5);
seems to directly contradict what the 3rd graph on that page suggests, giving a constant value for x < 0.5 rather than the decreasing curve shown. That is not something I can help with though as I'm not at all familiar with the equations and can't afford that amount of time to look at them more deeply.
  1 Comment
Rick on 17 Sep 2014
I see what was wrong, it was supposed to be
V_PFR(i) = (-1000/(10^-8/3)*-X(i));
However, the first graph didn't change when I put in the y-limits

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!