Re: ListPlot and List problem
- To: mathgroup@smc.vnet.net
- Subject: [mg10895] Re: ListPlot and List problem
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Thu, 12 Feb 1998 20:15:28 -0500
- References: <6bprkj$arg@smc.vnet.net>
Lars Freund wrote:
>
> Hi,
>
> I want to plot data that is stored in a file having in the format:
>
> <frequence> <phase> <amplification>
>
> and want to plot the BODE-Diagram. So I did:
>
> myData = ReadList["filename",{Number, Number, Number}];
>
> and now want a plot from <phase> over <frequence> and <amplification>
> over <frequence>I tried things like
>
> ListPlot[Transpose[testData][[3]],PlotJoined->True]
>
> but I always got the wrong list-format. I need
>
> {freqence1,phase1},{freqence2, phase2}...
>
> and I always get things like
>
> {phase1, phase2, phase3} or so.
>
> Can anybody help me a bit?
>
> Thanks,
>
> Lars
If the list that you get from ReadList is
In[1]:=
myData= {{f[i], p[1], a[1]}, {f[i], p[2], a[2]}, {f[i], p[3], a[3]},
{f[i], p[4], a[4]}};
Then we can get
In[2]:=
#[[{1,2}]]&/@myData
Out[2]=
{{f[i], p[1]}, {f[i], p[2]}, {f[i], p[3]}, {f[i], p[4]}}
In[3]:=
#[[{1,3}]]&/@myData
Out[3]=
{{f[i], a[1]}, {f[i], a[2]}, {f[i], a[3]}, {f[i], a[4]}}
--
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642