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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 How do I create a Sin*Cos function?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

chrothenbach

USA
5 Posts

Posted - 10/21/2009 :  11:54:15 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: V7.5885 (B885)
Operating System: Vista

For my PhD project I need to fit some curves to a function. I tried all the formulas that come within OriginPro and the best fit I could achieve was with the ECS formula, but I do not believe it is exactly what I need.

What I need is some sort of Sin*Cos, which comes from solving the electrical field for a diffraction grating using Maxwell's Equations. This formula should be of the form:

y=C*Sin(A*x)*Cos(Pi*B*x).

A,B,C are parameters that I do not know the values for.

How can I define a formula for that? I tried to do it myself and miserably failed. Can someone give me a hand here?

-Christian

chrothenbach

USA
5 Posts

Posted - 10/21/2009 :  12:00:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
y=(C*Sin(A*x)*Cos(Pi*B*x))^2 should be the correct formula.
Go to Top of Page

easwar

USA
1965 Posts

Posted - 10/21/2009 :  12:19:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by chrothenbach

y=(C*Sin(A*x)*Cos(Pi*B*x))^2 should be the correct formula.




Hi,

By default Origin C is used when defining a new fitting function. And Origin C is case sensitive, so instead of Sin() need to use sin().

So try changing your function definition to:
y=(C*sin(A*x)*cos(Pi*B*x))^2;

Pi is okay, as pi, Pi and PI are all predefined.

You can click the Edit in Code Builder button and then try compiling the code to get error messages that can then tell what is wrong.

Easwar
OriginLab
Go to Top of Page

chrothenbach

USA
5 Posts

Posted - 10/21/2009 :  12:56:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks for the reply...

Could I create a fdf file? I am not very familiar on how to use a C file yet, and I also do not know how to use a C file when curve fitting.

Do I have to define variables?
Go to Top of Page

easwar

USA
1965 Posts

Posted - 10/21/2009 :  1:14:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In your 7.5 installation, look at this help topic:
Analysis: Curve Fitting>The NLSF Advanced Fitting Tool>User-Defined Fitting Functions>
to learn more about creating user-defined functions.

Easwar
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000