help-octave
[Top][All Lists]

## Re: Plotting Variable Output

 From: Ben Abbott Subject: Re: Plotting Variable Output Date: Sun, 26 Oct 2014 19:12:07 -0400

```> On Oct 26, 2014, at 5:58 PM, Edward Song <address@hidden> wrote:
>
> I have output produced from a complex mathematical economic model that
> required many iterations. Because of its complexity, using matrices and
> vectors was not feasible. The structure of my program was
>
> Set Parameter Values
> Set Initial Conditions
> Create 40 loops to calculate values of economic variables for 40 periods
>    In each period, iterations are required due to nonlinear equations
>    Final period values are given a unique name to prevent all intermediate
> values from being plotted
> End Loop
>
> Plot Economic Values versus time
>
> My subroutine to plot consumption over time is:
>
>        plot(t, Consumption_g1)
>    title("Consumption Growth for Group 1 Family with Income and Wealth Tax")
>    xlabel("Period")
>    ylabel("Consumption")
>    legend("Consumption")
>    print -dpdf 'cgrowthg1YT80KT5'
>
> (The title means consumption growth for group 1, with income tax rate of 80%
> and wealth tax of 5%) Unfortunately, no plot is created. The title, labels,
> legend and title are created correctly. However, the axis only displays the
> tail end of the data. Thus, on the X-axis, time periods for periods 38 to 46
> are plotted, not from 0 to 40. The same is true with the economic variables.
> But most important of all, there is no plot.
>
> Is the problem because the variables are not put into matrices and vectors?
> If so, how would I do this. I can't do it manually because the data output
> is thousands of pages long, so I can't find the appropriate numbers. If not,
> what are the other possibilities of what's going wrong?
>

If you type

Consumption_g1

at the command line, you'll be able to see what it contains.  My guess is that
it contains NaNs.  Which implies there are numerical problems with you
calculations.

If you can share your m-files, we may be able to debug them.

Ben

```