I am trying to fit this function on my experimental data and receive the values of G and f. My data ought to look like this.
DR=exp(1i*f)/(E-Eg-1i*G)
Where Eg=1.18, DR and E are my measurements as arrays. f is the phase, E, Eg and G are all measured in eVs.
I am trying to utilize the LSQNONLIN function.
My question is: How do I have to define the function that needs to be inserted in LSQNONLIN in order to make it work?

댓글 수: 2

Christos
Christos 2014년 9월 19일
편집: Christos 2014년 9월 19일
Thank you,
I currently have these 2 scripts
1)fn.m
function deltaR1 = fn(E,G)
deltaR1=1/(E-1.18-1i*G);
and 2) fitting.m
E=E1;%E1 and DR1 are the names of my arrays
DR=DR1;
ft=lsqcurvefit('fn(E,G)');
f=fit(E,DR,ft);
A=coeffvalues(f);
fplot(f)
Matlab returns this error:
Error using lsqcurvefit (line 167) The input to LSQCURVEFIT should be either a structure with valid fields or consist of at least four arguments.
Error in fitting (line 6) ft=lsqcurvefit('fn,E,G');
Matt J
Matt J 2014년 9월 19일
The way you are invoking lsqcurvefit does not resemble any syntax in the documentation...

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt J
Matt J 2014년 9월 19일

0 개 추천

I think you should use lsqcurvefit instead. Other than that, see this recent related thread for dealing with complex valued functions,

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

질문:

2014년 9월 19일

댓글:

2014년 9월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by