How to plot the diagram using Excel or Matlab?

Discussion in 'Cadence' started by Allen, Apr 24, 2005.

  1. Allen

    Allen Guest

    Hi,

    I got the data of ac response diagram. The x axis is frequency, y axis
    is the amplitude. I want to modify the data and plot it using Excel
    or Matlab. But there are "u, m, K, M, G" in the data, how can I plot
    the diagram?

    Thanks

    Regards,
    Allen
     
    Allen, Apr 24, 2005
    #1
  2. Allen

    boa Guest

    Maybe that's not the best solution, but I simply replaced "u" to e-6,
    "m" to e-3 etc using Find/Replace All function in any text editor
    before importing data to Matlab.

    Alex
     
    boa, Apr 25, 2005
    #2
  3. Allen

    Dylan Guest

    In the print window options you can choose to use scientific notation.

    -Dylan
     
    Dylan, Apr 25, 2005
    #3
  4. I'm assuming you mean that the data looks like:

    Frequency,Amplitude
    1M,1.005u
    1.5M,1.230u
    ...

    This is a perfect application for sed. "man sed" and/or borrow
    someone's awk/sed book to learn about it. To get you started:

    sed -e '1 p' -e '1 d' \
    -e 's/p/e-12/g' \
    -e 's/n/e-9/g' \
    -e 's/u/e-6/g' \
    -e 's/m/e-3/g' \
    -e 's/k/e+3/g' \
    -e 's/M/e+6/g' \
    -e 's/G/e+9/g' filename_in.csv > filename_out.csv

    What this means:
    -e XXXX Execute sed command XXXX.
    '1 p' If this is line #1, print it.
    '1 d' If this is line #1, skip the rest of the commands.
    's/u/e-6/g' Substitute ('s') the 'u' character with 'e-6'.
    The 'g' on the end means do it globally; otherwise
    only the first occurrence is replaced.

    Text processing data files using sed, awk, etc., is admittedly a hack,
    but a very useful hack for one's toolbox nonetheless.
     
    David Cuthbert, Apr 25, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.