scatterplots and curve fitting

I've been using a combination of Fortran and gnuplots to do my plots. my research required an intensive amount of data plotting. I've been trying to use maple to do scatterplots and curve fitting for my data. here is the code:

> K := readdata("/Users/xxx/Work/dt40s5l10.110/ALL/dt40s5l10.110.1.DFIR.AVE", 8)
# the file contains 2972 lines and 8 columns of data
> unassign('G', 'X');
> seq(assign(G[i], (K[i+1, 5]-K[i, 5])/(K[i+1, 1]-K[i, 1])), i = 1 .. 2970); # to calculate the derivative
> seq(assign(X[i], K[i, 1]), i = 1 .. 2970);

when I tried to plot X vs G using scatterplots

>with (Statistics):
> ScatterPlot (X,G);

I don't get anything, it's just rewrite the line. What should I do to make this work?

my second question if I want to plot or fit a curve over a certain range of X. for example if the Values of X ranges from -60 to 60, can I plot only from 0 to 60 or fit a function in that range only instead the whole thing.

thank you in advance

Comments

Robert Israel's picture

ScatterPlot

1) Your X and G are tables.  ScatterPlot needs Vectors or lists.  I'm surprised you don't get an "invalid input" error message.
You might try

> ScatterPlot(convert(X,list), convert(G,list));

2) To restrict a plot P to a certain window, x from a to b and y from c to d (where a,b,c,d are real constants):

> plots[display](P, view=[a..b, c..d]); 

 

ScatterPlot

thanks Robert,

I fixed the table to list issue but I still don't see the difference between the 2. the problem that I still have the computer doesn't recognize the ScatterPlot command even when I use the with(Statistics)? any thoughts about that?

thanks

Robert Israel's picture

ScatterPlot

Make sure you spelled it right.  Maple is case-sensitive. 

 

fsolve values

I've been working with fsolve and I'm having the following issue:

fsolve({dif_Fliq=((nFsol-nFliq)/(psi_sol-psi_liq)),dif_Fliq=dif_Fsol},{psi_sol=0.1..0.9,psi_liq=0.1..0.9});
{psi_liq = 0.4447971078, psi_sol = 0.3459845910}

how do I get the value of psi_liq and psi_sol and assign them to a different variable without having to copy the whole thing? i.e.

if I use the following command
assign(result_liq,psi_liq);
I get

result_liq=psi_liq = 0.4447971078 not what I want result_liq = 0.4447971078

I also tried:

result_liq:=psi_liq and I ended up with the same result

any thought on how to do this?

thanks

fsolve values

> sol:=fsolve({x+y,x-cos(y)},{x,y});
                 sol := {x = 0.7390851332, y = -0.7390851332}

> usex := eval(x,sol);
                             usex := 0.7390851332

> x;
                                       x

> usex;
                                 0.7390851332

> usex, usey := eval(x,sol), eval(y,sol);
                   usex, usey := 0.7390851332, -0.7390851332

> x, y;
                                     x, y

> usex, usey;
                          0.7390851332, -0.7390851332

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}