
variable lo, hi, f, fe17_lines, s;

    %  Load the spectroscopy database

plasma(aped);

    %  define a wavelength grid for the model spectrum

(lo, hi) = linear_grid (1, 35, 8192);

    %  One way to define a multi-component spectral
    %  model is by using an array of structures.
    %  Here, we use a simple model with only one
    %  temperature component (see the advanced examples
    %  for details on computing more complicated models):

s = default_plasma_state();
define_model (s);

    %  To compute the contribution from Fe XVII lines
    %  alone, we first obtain a list of the Fe XVII lines...

fe17_lines = where(el_ion(Fe,17));

    %  Then we compute the spectrum on the specified grid,
    %  using the MODEL_LINES keyword to specify that
    %  only line emission should be included:

f = model_spectrum (lo, hi, MODEL_LINES, fe17_lines);

    %  Now, plot the result:

variable id = plot_open ("ex_linespec.ps/cps");

xlabel (latex2pg ("\\lambda" + " [\\A]"));
ylabel ("Flux");
title ("Fe XVII line spectrum");
hplot (lo, hi, f);

plot_close (id);

