How to create a 'fittype' calling PDE toolbox function

2 views (last 30 days)
I'd like to call a function that solves PDE to fit a surface named 'surface2'. Here -in three lignes- what I have guessed so far (all variables are previously defined):
ft=fittype(@(Tau,D,Rrad,x,t) fct_fit(Tau,D,Rrad,ni,FWHM,x,t),'independent',{'x','t'},'coefficients',{'Tau','D','Rrad'})
[tmp1 ,tmp2, tmp3]=prepareSurfaceData(x,t,surface2);
[surffit,strt] = fit([tmp1 ,tmp2],tmp3,ft)
Important point : if i run ony: fct_fit(ni,FWHM,Tau,D,Rrad,x,t) it is working well and it gives me the simulated matrix with the input paramters
BUT, if I run the full line 'ft' for the fittype it tells me 'Expression fct_fit(Tau,D,Rrad,ni,FWHM,x,t) is not a valid MATLAB expression, has non-scalar coefficients, or cannot be evaluated:
Error while trying to evaluate FITTYPE function :
The entries of TSPAN must be strictly increasing.
Also things i have tried (still same things): adding a z dependent variable ; chnaging the order fct_fit(ni,FWHM,Tau,D,Rrad,x,t) by fct_fit(Tau,D,Rrad,ni,FWHM,x,t)
Thanks in advance for your help

Answers (0)

Categories

Find more on Linear and Nonlinear Regression in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!