fittype issue: problem in producing same size and shape output as input but evaluating outside of valid range

2 visualizzazioni (ultimi 30 giorni)
I wrote a function that gives the same size and shape output as input as long as my input values are positive and greater than 200 for ek.
function is as follows
function rot = states(ek)
syms jj
rot_lv=[];
for ii=1:length(ek)
eqn= 91.279790284826035 + 0.190999999999999*jj.^2 + 18.550*jj + 18.550*sqrt(jj.^2 + 21.576585755697792) -ek(ii) ==0 ;
xv1 =(vpasolve(eqn, jj));
rot_lv=[rot_lv xv1];
end
rot = rot_lv ;
So far so good!
Now I want to use this function for fit as follows
x =@(ek1) states(ek1)
ft = fittype(@( T, eker) T*x(ek1) , 'independent', 'ek1', 'dependent', 'y', 'coefficients', 'T' )
I got following error
Custom equations must produce an output vector, matrix, or array that is the same size and shape as the input data. This custom equation fails to meet
that requirement:
T*x(eker)
Error in fittype>iCreateFittype (line 373)
testCustomModelEvaluation( obj );
Error in fittype (line 330)
obj = iCreateFittype( obj, varargin{:} );
I figured out that , the issue is in fittype when its trying to calculate the validity of equation outside of its valid range of ek (positive and >200). Please suggetst the way out.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by