problem with curve fitting in Matlab - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

problem with curve fitting in Matlab

katusha-vkatusha-v Posts: 1Member
Hi all,

I'm trying to fit a data with a function called "refl_pp" that I construct myself. I tried to use fit routine:

ffit = fittype('@(A1,A2,k1,k2,Step,t,t0,w)refl_pp','independent','t','problem','Step');
F=fit(t,data',ffit,'StartPoint',[0.0005 0.0001 3. 1. 0.1 3.3],'problem',Step);

As a result I get an error message:
??? Matrix dimensions must agree.

Error in ==> fit at 486
errstr = handleerr( errid, errmsg, suppresserr );

Error in ==> TiSe_phonon_fit at 37
[F,gof]=fit(t,data',ffit,'StartPoint',[0.0005 0.0001 3. 1. 0.1 3.3],'problem',Step);

I had no problems, if I pass a function as a string in fittype, so it seems like I handle the function not correctly.
Does anybody know what the problem is?

thank you in advance, katja
Sign In or Register to comment.