quote:
Originally posted by Sumeet kumar
I am trying to fit data to a function having six parameters and a constant. I entered the values of the constant and parameters to check whether the function is working or not. But I got different values from the function from Origin than from Matlab. I have attached Matlab code below in which in the lower comment, I directly copied and pasted the function written in Origin.
clear; clc;
n2 = 3;
k2 = 0.1;
n3 = 4;
k3 = 2.5;
kp = 1e-18;
t0 = 600;
lam = 1.625e-6;
t = 0;
y = 1 - abs((((1-n2)+i*k2)*((n2+n3)-i*(k2+k3))+((n2-n3)-i*(k2-k3))*((1+n2)-i*k2) ...
*exp(4*pi*sqrt(kp*(t+t0))*(-k2-i*n2)/lam))/(((1+n2)-i*k2)*((n2+n3) ...
-i*(k2+k3))+((1-n2)+i*k2)*((n2-n3)-i*(k2-k3))*exp(4*pi*sqrt(kp*(t+t0))*(-k2-i*n2)/lam)))^2
%y = 1 - abs( ( ( ( 1 - n2 ) + 1i * k2 ) * ( ( n2 + n3 ) - 1i * ( k2 + k3 ) ) + ( ( n2 - n3 ) - 1i * ( k2 - k3 ) ) * ( ( 1 + n2 ) - 1i * k2 ) * exp( 4 * pi * sqrt( kp * ( t + t0 ) ) * ( -k2 - 1i * n2 ) / lam ) ) / ( ( ( 1 + n2 ) - 1i * k2 ) * ( ( n2 + n3 ) - 1i * ( k2 + k3 ) ) + ( ( 1 - n2 ) + 1i * k2 ) * ( ( n2 - n3 ) - 1i * ( k2 - k3 ) ) * exp( 4 * pi * sqrt( kp * ( t + t0 ) ) * ( -k2 - 1i * n2 ) / lam ) ) )^2
Thanks all
abs, exp, sqrt etc. does not support complex number in Origin.
You can handle the real part and the imaginary part separately.
&&&&&&&&&
&&&
&&
& _____ ___________
II__|[] | | I I |
| |_|_ I I _|
< OO----OOO OO---OO
**********************************************************