Home > Archive > Fortran > November 2005 > Re: "USE MATLAB" writing at the end of the lines
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: "USE MATLAB" writing at the end of the lines
|
|
|
| > I am sure some of you must have faced a similar problem. What do you
> guys do? If there is a plotting program which is sane enough to
> recognize that plotting across rows is as useful as plotting across
> columns, I would like to use it.
If that's what you want, don't waste your time on that. MATLAB can
easily take care of it. I assume your output file is ASCII file and let
us call it "output.txt". Here is a short MATLAB command that plots your
data at t = t10.
load output.txt
plot(ouput(10,:));
Good luck
Irfan
Kamaraju Kusumanchi wrote:
> Richard Maine wrote:
>
> First of all, Thank you all for the replies.
>
> Actually I have been through this path. This is my original situation.
> Imagine I am writing a program which gives the value of f(x,t) at a
> given time step t_i. Let there be m grid points in x direction and the
> idea is to see how f(x,t) evolves over time in n time steps.
>
> Now due to the size of the arrays and the large number of time steps
> required etc., it is not an option to store all the data (which would
> require storage of m*n data points). So at any given point of time I
> store only the x array (which will be m data points).
>
> When I write the output of this program on to a file the output looks
> something like this:
>
> time x_1 x_2 x_3 x_4 ..... x_m
> t_0
> t_1
> t_2
> .
> .
> .
> .
> t_n
>
> where I append the data at the new time step to the end of the file.
>
> But the problem with above approach is that most of the plotting
> softwares I tried (gnuplot, labplot etc.,) plot only across columns and
> cannot plot across rows (I am using Debian Sid if it matters). Due to
> this weird limitation of the plotting softwares I cannot plot the
> evolution of f(x,t) vs x over time without any external processing.
>
> For example if I am able to write my data as
>
> position t_0 t_1 t_2 t_3 .... t_n
> x_1
> x_2
> x_3
> .
> .
> .
> .
> x_m
>
> then it is trivial to plot evolution of f(x,t) vs x for different times
> using gnuplot without the need of external processing of data. Now I
> really would like to eliminate doing something extra beside the fortran
> program and that is why I asked the original question.
>
> I am sure some of you must have faced a similar problem. What do you
> guys do? If there is a plotting program which is sane enough to
> recognize that plotting across rows is as useful as plotting across
> columns, I would like to use it.
>
> Now before anyone asks whether gnuplot can plot across rows - The answer
> is NO. It cannot do it without transposing the data by external programs
> like awk script etc., The following links confirm this fact.
>
> http://groups-beta.google.com/group...b62557507eea08b
>
> http://groups-beta.google.com/group...096895759b8f145
>
> http://groups-beta.google.com/group...f3008bc6061ab37
>
> http://groups-beta.google.com/group...77c321d33dadbc6
>
>
> Regarding labplot, I filed a wishlist bug asking for such a feature
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340530 . But not sure
> if the original author finds this interesting enough to implement it. I
> have talked to one of my friends who uses tecplot (a commercial data
> visualization software) and it also cannot plot across rows.
>
> thanks in advance
> raju
>
> --
> Kamaraju S Kusumanchi
> http://www.people.cornell.edu/pages/kk288/
> http://malayamaarutham.blogspot.com/
| |
| Kamaraju Kusumanchi 2005-11-29, 7:01 pm |
| kis wrote:
>
>
> If that's what you want, don't waste your time on that. MATLAB can
> easily take care of it. I assume your output file is ASCII file and let
> us call it "output.txt". Here is a short MATLAB command that plots your
> data at t = t10.
>
> load output.txt
> plot(ouput(10,:));
>
> Good luck
> Irfan
>
>
Apart from the other wonderful suggestions I received in this thread,
your solution is working flawlessly for me. What is better is that I am
using octave (as I cannot purchase Matlab) which is a open source
version of Matlab and it is using gnuplot for plotting. So I guess, I
would be able to do all the 'gnuplot stuff' + get the functionality
to plot across rows.
thanks again
raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/
| |
| Michael Prager 2005-11-29, 7:01 pm |
| Kamaraju Kusumanchi <kk288@cornell.edu> wrote:
> If there is a plotting program which is sane enough to
> recognize that plotting across rows is as useful as plotting
> across columns, I would like to use it.
Apparently you have already found Octave. Another option would
be R, which is free, has superb graphics (as you can see from
the home page), and is well worth knowing if you are doing much
statistics or graphics.
For example, the following two lines of R code create a 2 x 100
matrix with an index in the first row & random numbers in the
second, then plot the random numbers agains the index:
testme = matrix(c(1:100,rnorm(100)), byrow=TRUE, nrow=2)
plot(testme[1,], testme[2,])
http://www.r-project.org/
--
Mike Prager, NOAA, Beaufort, NC
Address spam-trapped; remove color to reply.
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.
|
|
|
|
|