The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Y axis fitting

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
kdsaransh Posted - 01/16/2015 : 05:57:38 AM
Hello,

Is there a way to fit the graph as per the Y axis value. Actually i want to fit a graph whose Y axis value is from 40dB to 0dB. since my x axis value changes from sheet to sheet, hence fixing the ROI region for x value gives me a wrong intercept and slope value and is also not fitting properly.


Thanks and regards,

Rajesh Agarwal
5   L A T E S T    R E P L I E S    (Newest First)
lkb0221 Posted - 01/19/2015 : 10:25:51 AM

You can try plot your X against your Y:

plotxy iy:= [mybook51]Sheet1!(1,$(ii)) // Before
plotxy iy:= [mybook51]Sheet1!($(ii),1) // After
kdsaransh Posted - 01/17/2015 : 01:41:19 AM
Thanks,

But i am doing linear fitting.

My code is as follows:

string fns, path$="C:\Users\babia\Desktop\origin";
findfiles f:=fns$ e:="*.dat";
int n = fns.GetNumTokens(CRLF);
string bkName$;
string fname$;
for(int ii = 1; ii<=n; ii++)
{
impasc fname:=fns.GetToken(ii, CRLF)$ options.ImpMode:=1 options.Sparklines:=0 options.Names.FNameToSht:=0
options.Names.AutoNames:=0
options.Names.FNameToBk:=0
options.Names.FNameToBkComm:=0
options.Names.FNameToColComm:=1
options.Names.FPathToComm:=0;

Col($(2*ii-1))[L]$="Frequency";
Col($(2*ii))[L]$="Gain";
Col($(2*ii-1))[U]$="Hz";
Col($(2*ii))[U]$="dB";

}
for(int ii = n-1; ii>=1; ii--)
{
del Col($(2*ii+1));
}

win -r %H mybook51 ; // rename a workbook
Win -a mybook51; //activate a workbook

for(int ii = 2; ii<=n+1; ii++)
{
range rWa = [mybook51]sheet1!; // Define a worksheet object range
rWa.colSel(ii-1,0); // deselect col 2.
rWa.colSel(ii,1); // select column 2. 1 stands for select. If 0 stands for deselect.
plotxy iy:= [mybook51]Sheet1!(1,$(ii)) ogl:=[<new template:="
C:\Users\babia\Documents\OriginLab\91\User Files\ac_nonfitting.otp" name:=samplegraph>];
// renames the graph name to worksheet comment name.

page.label$ = %(1,@LC);
layer -a;

layer.x.from = 60; //Set the end value
layer.x.to = 900000; //Set the increment value
//layer.x.inc = 2;

StartRange=70;
EndRange=950000;
mks1=xindex(StartRange,%C);
mks2=xindex(EndRange,%C);

// from quick fit gadget, using fix ROI
addtool_quickfit trroi.XScale.leftx:=70 trroi.XScale.rightx:=100000 trroi.XScale.fixscale:=1 trroi.ShowTop.RSqr:=1 trroi.RectColor:=17 trtable.Params:=2 trtable.ReduChisq:=0 trtable.Correlation:=0 trreport.ReduChisq:=0 trreport.Correlation:=0;

gadget gg = rect; //declare LT gadget variable
gg.output();

range p1=1!1; //The first plot
set %c -c 4; //Change the line's color
set %c -d 1; //Change the line's style.

Echo=1;
Echo=2;
Echo=3;
Echo=4;
Echo=7
}


Please help me out.

thanks
lkb0221 Posted - 01/16/2015 : 3:30:10 PM
Then simply switch your XY.
for example:
nlbegin iy:=(1,2) func:=gauss; // Before.
nlbegin iy:=(2,1) func:=gauss; // After
kdsaransh Posted - 01/16/2015 : 11:03:03 AM
Hi,

Thanks , but this doesn't solves my problem. I don't want to be dependent on x axis value. I simply want to set the data marker to 0db and 40 db of Y axis and then do the fitting using script. I hope that its clear. Should i post my code ???

Thanks
lkb0221 Posted - 01/16/2015 : 09:28:43 AM
Hi,

You can use Xindex function to get the index number of corresponding X value by a Y value.
http://www.originlab.com/doc/LabTalk/ref/Xindex-func

Zheng
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000