| Author |
Topic  |
|
|
senigalliese
Australia
Posts |
Posted - 01/13/2006 : 7:22:22 PM
|
Origin Version (Select Help-->About Origin): 7.5 Operating System:XP
Dear friends of the forum, here is the problem that ruined my past 4 hours. I am fitting an electrical resistivity curve vs temperature with a non linear regression, from 1K to 300K. Since the resistivity power law changes with temperature and I need to know when this happens I fit the whole curve fitting temperature ranges of, let's say, 5K at a time, moving step by step towards 300K, and letting them overlap a little. For each step I get then one NLSF worksheet of the fit in the relative range. At the end of the loop I will have many NLSF1,2,3,4,5... worksheets, and I need to have them all in one wks only. It is driving me crazy, I am sorry but I cannot make it myself. Any ideas? Sorry for bothering you all once again. |
|
|
senigalliese
Australia
Posts |
Posted - 01/14/2006 : 08:25:18 AM
|
In addition I would like to say that for this kind of delicate analysis my datafile to fit is a little too noisy unfortunately. Let's say that my sample undergoes two transitions, at the beginning the power law is y=Ax^(2), then at a certain x(i) it changes into y=Ax^(5/3) and finally at x(j) into y=Ax^(3/2). If I make a linear fit of the ln y= ln x the slope should be indeed the exponent (2,5/3,3/2), and I divide the whole range of x values into smaller (and slightly overlapping) ones that move towards Xmax when plotting the fitted exponent versus x I should get "ideally" 3 plateaus at 2, 5/3 and 3/2. Unfortunately, because of the noise i can hardly see them as the fitted exponents seem to produce a wave around the real plateau values, and this can have an amplitude as big as the gap between one value to the other (let's say 2 - 5/3 for example). I need to store the fitted X and Y values (let's say 30 points) of each fitting interval. At the end, if I store everything in one 2-column worksheet I can restart the fitting process again iteratively on a curve (generated by all the overlapping fits) which is much less noisy than the original. I hope that in this way in a few iterations, the wavy behaviour disappears leaving me with the "real" plateaus at 2, 5/3 and 3/2. That's the whole situation. The noise is the problem! |
 |
|
|
senigalliese
Australia
Posts |
Posted - 01/14/2006 : 08:34:06 AM
|
This is the routine I wrote to get the power law exponent versus temperature. I'm sure there are errors and it is stylistically ugly but it works, although I cannot store the fitted X and Y values, and I am not sure that uses the 4th column as weightening column!
// This routine needs a three-column data file, the first column is Log(temperature) // the second is Log(resistance-rhozero) and the third is just temperature. In addition I have a 4th; //column where the lock-in amplifier aou of phase reading that can be used as a sort of error column of; //the resistivity values.
%A=%H; //read and assign the name of the active window;
//sort the whole worksheet on ascent Temperature values sort -w %A col(1); Create LOGEXP -w 128; //creates a worksheet named LOGEXP with 128 rows wo -a 16; // add 8 columns; win -a %A; //set %A as active once again worksheet -s 1 0 2 0; //select column 1 and 2 %B=wks.col2.name$; win -t plot Template_wks_Senigallies.otp LOGRES; //creates a graph window named LOGRES layer -i %A_%B; layer -a; run.section(Plot,general,201); // Get length of active dataset limit %c; nRows=%A!wks.maxRows; // Set the width of fitting intervals in rows Y=150; // Incremental step W=Y/10; // Loop over each group of points in active dataset
for(i = 1; (1 + (i - 1)*W +Y) <= nRows ; i++) { win -a LOGRES; // Use nlsf.dataBegin, nlsf.dataEnd to set data markers BB = 1 + (i - 1)*W ; EE = 1 + (i - 1)*W + Y + BB/10;
stat.confLevel=99.9
stat.errBarData$=Data1_D;
stat.fitxdata$ = trova1; //dataset to store fitted x values
stat.fitYdata$ = trova2; //dataset to store fitted y values
stat.makeX.fitnpts = 20; //number of points of regression curve
lr -n %C -b BB -e EE; %(LOGEXP,1, i)=(%A!cell(EE, 3) + %A!cell(BB, 3))/2; %(LOGEXP,2, i)=(%A!cell(EE, 3) - %A!cell(BB, 3))/2; %(LOGEXP,3, i)=$(lr.b); %(LOGEXP,4, i)=$(lr.sdb); %(LOGEXP,5, i)=$(lr.a); %(LOGEXP,6, i)=$(lr.sda); %(LOGEXP,9, i)=$(lr.sd); %(LOGEXP,10, i)=$(lr.n); %(LOGEXP,11, i)=$(stat.DS.var); %(LOGEXP,12, i)=W; %(LOGEXP,13, i)=Y; };
win -a LOGEXP; //LOGEXP_%A=col(a)*cos(tt); worksheet -s 1 0 2 0; //select column 1 and 3 %B=wks.col3.name$; wks.col2.type = 7; wks.col4.type = 3; win -t plot Template_wks_Senigalliese.otp LOGEXPPlot; //creates a graph window named LOGEXPPlot layer -i LOGEXP_%B LOGEXP_b LOGEXP_d; layer -a; run.section(Plot,general,201); |
 |
|
| |
Topic  |
|
|
|