Numerical values into plot issue

1 view (last 30 days)
I created a code that takes an initial guess for a distribution and then modifies it. After completing the code it then is supposed to plot the modified distribution, however it is plotting both the guess values and final values. My guess looks something like:
Tfuel = zeros(nr+1);
Tfuel(:) = 800;
The guess is then modified very much like the following statement:
I used the basic plot command as:
Any idea why this is occurring? I have never had this issue before.
  1 Comment
karan on 25 Nov 2011
use fplot as tfuel is still getting values as it is being used

Sign in to comment.

Accepted Answer

Wayne King
Wayne King on 25 Nov 2011
I suspect maybe you want
Tfuel = zeros(nr+1,1);
instead of
Tfuel = zeros(nr+1);
With the above you are creating a nr+1-by-nr+1 matrix and then with
Tfuel(:) = 800;
You are filling the whole matrix with 800. Then in your loop
Tfuel(1) % or whatever you index i is
You are only filling the first column.
  1 Comment
Cameron Thames
Cameron Thames on 25 Nov 2011
That did the trick.
Thank you

Sign in to comment.

More Answers (1)

karan on 25 Nov 2011
Use fplot

Community Treasure Hunt

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

Start Hunting!