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
 User defined NLF complex function using cosh()
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jp.medina11

France
1 Posts

Posted - 09/07/2024 :  7:21:57 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I am trying to compile a user defined complex function using cosh() in the code builder tab at the NLF fitting Fuction Organizer of OriginPro 2022b. However, I get the error message "Error, cannot convert argument(1) in function call". For some reason when I use the function cos(), it compiles all. But I need the hyperbolic instead. Moreover, if I try to use the function ImCosh(), it is not recognized and the displayed error message is: "Error, function or variable ImCosh not found". The code is here below, if someone can help me I am very grateful!

-------------------------------------------------

void _nlsfIMPS_Complex(
// Fit Parameter(s):
double tau, double alpha,
// Independent Variable(s):
double omega,
// Dependent Variable(s):
double& y1, double& y2)

complex cc = cosh(1+1i*tau*alpha*omega);
y1 = cc.m_re;
y2 = cc.m_im;

-------------------------------------------------

Thanks!!

Juan Medina

YimingChen

1594 Posts

Posted - 09/09/2024 :  09:04:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The cosh() function does not accept the complex number as the argument.
https://www.originlab.com/doc/OriginC/ref/cosh

The workaround is to use cos() function since cosh(x) = cos(ix).


complex cc = cos(1i*(1+1i*tau*alpha*omega));
y1 = cc.m_re;
y2 = cc.m_im;


James
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