Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

[bestpar, resnorm, residual, exitflag, output, lmd, jacobian] == lsqnonlin (@ fz_costo_sana.m, startpar [0.01 0.01; .01] [10 10 10] options) ';

댓글 수: 2

Undefined function 'fz_costo_new.m' for input arguments of type 'double'.
please tell me how to clear this error
To fix that problem, what you need to do is create a new folder named
mkdir('+fz_costo_new')
movefile( 'fz_costo_new.m', '+fz_costo_new/m.m')
Now your function will be named 'm' inside the package that is named fz_costo_new and MATLAB will be able to resolve the function when you use @fz_costo_new.m
I do not recommend that. I recommend that you instead fix your source code so that instead of
@fz_costo_new.m
that you use
@fz_costo_new
but as I have recommended that to you three times before and you are not willing to do that, then the above mkdir() / movefile() will reconfigure so that you can continue to use @fz_costo_new.m

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

 채택된 답변

clear
clear global
clc
close all
%format long
global SRex Km Ke V IL6b RaIL6 Tv t_start t_end dataIL6GLP1 t
% -------------------------------------------------------------------------
% NB: GLYCEMIA has to be expressed in (mmol/l
% INSULINEMIA has to be expressed in (mU/l)
% -------------------------------------------------------------------------
% -------------------------------------------------------------------------
% OGTT MUSCELLI DATA NORMO
% E. Muscelli, A. Mari, A. Natali, B.D. Astiarraga, S. Camastra, S. Frascerra, J.J. Holst, E. Ferrannini, Impact of incretin hormones on ?-cell function in subjects with normal or impaired glucose tolerance, Am. J. Physiol. Endocrinol. Metab. 291 (2006) E1144-E1150.
t_start=1;
%%
%
% for x = 1:10
% disp(x)
% end
%
t=[0 10 20 30 40 60 90 120 150 180];
dataGLP1out=[-0.0611404034260573;0.153761026536856;0.381887441294696;0.577225771343123;0.785935420734692;1.02732340392451;1.28878665794757;1.46511064263731;1.60857337534354;1.75203610804977;1.79782967573179;1.72437887843715;1.63132839759097;1.49215509632929;1.40577198333615;1.31946203761713;1.21963443800674;1.14002844377781;1.05353557987351;0.927440928858545;0.867507785455261;0.788267627596867]';
dataIL6out=[-0.0611404034260573;0.153761026536856;0.381887441294696;0.577225771343123;0.785935420734692;1.02732340392451;1.28878665794757;1.46511064263731;1.60857337534354;1.75203610804977;1.79782967573179;1.72437887843715;1.63132839759097;1.49215509632929;1.40577198333615;1.31946203761713;1.21963443800674;1.14002844377781;1.05353557987351;0.927440928858545;0.867507785455261;0.788267627596867]'*(1/6); %conversion from pmol/l to mU/l
% GIP+GLP1
% incretinaOGTT=[145.716 270.0798 339.5178 329.7588 322.815 318.4284 272.0028 280.0878 284.4702 254.0166]';
SRex = 0.050;
Km= 0.009;
Ke = 0.059;
V = 14;
IL6b =1.7;
RaIL6 = Ke*IL6b*V;
Tv =67;
%t_start= 1;
t_end = 155;
%RaINCb = 217;
%K1= 1;
%K2=0.1;
%t_end=180;
% ----------------------------------------------------------------
%OGTT NAUCK DATA HEALTHY
% M.A. Nauck, A. El-Ouaghlidi, B. Gabrys, K. Hücking, J.J Holst, C.F Deacon, B. Gallwitz, W.E. Schmidt, J.J. Meier, Secretion of incretin hormones (GIP and GLP-1) and incretin effect after oral glucose in first-degree relatives of patients with type 2 diabetes, Regul Pept. 122 (2004) 209-217.
% t=[0 15 30 45 60 75 90 120 150 180 210 240]';
% glicemiaOGTT=[5.54 8.04 11 11.54 10.64 8.73 7.27 5.73 5.14 4.64 4.63 4.68]';
%insulinemiaOGTT=[45.45 193.9 478.78 654.5 706.06 472.73 318.18 169.7 109.1 60.61 36.36 26.67]'*(1/6); %conversion from pmol/l to mU/l
%GIP+GLP1
%incretinaOGTT=[92.2602 298.347 418.8954 423.4032 431.433 402.3756 370.2276 289.7586 221.4258 178.7952 142.5594 104.3616]';
%Gb = 5.5;
%Ib = 7.6;
%Incb=90;
% k7 ESTIMATED FROM IIVG
%k7=0.158;
%tfinal=240;
% -------------------------------------------------------------------------
% -------------------------------------------------------------------------
dataIL6GLP1 = [dataGLP1out dataIL6out];
%FIXED PARAMETERS SIMULATOR
%D = 417; %quantity in mmol equivalent to 75g
%kabs=0.22;
%f=0.90;
% HGB_b=0.76875; % hepatic balance
V=14;
%M_ipog=0.03;
%alfa=1.0;
%p=2;
% K1=(p/(p+1))*HGB_b/((G_b)*V);
% K2=(1/(p+1))*HGB_b/(I_b*V);
%K3=0.0718; % different from zero only when G>10
%K4=0.717; % different from zero only when G>10
%K6=0.1;
%K9=0.1;
%Ra_INC_b=K6*INC_b*V;
%K5 = 6.91;
% ------------------------------------
% initial values for the parameters to be estimated
%K_0=0.013;
K1_0 = 1;
K2_0 = 0.1;
RaINCb_0=217;
% BETA_0=1;
% K5_0 = 25;
startpar = [K1_0 K2_0 RaINCb_0];
% -------------------------------------
options=optimset('Display','Iter','TolFun',1E-20,'TolX',1E-7,'MaxFunEvals',3000,'MaxIter',500)';
[bestpar, resnorm, residual, exitflag, output, lmd, jacobian]=lsqnonlin(@fz_costo_sana.m,startpar[0.01 0.01 .01] [10 10 10]options)'; nnnnnnnnnnnnnn
%bestpar, resnorm, residual, exitflag, output, lmd, jacobian
%K_0=bestpar(1);
K1_0=bestpar(1);
K2_0=bestpar(2);
RaINCb_0=bestpar(3);
% BETA_0=bestpar(4);
% K5_0=bestpar(5);
% beta=-K7*(G_b^1.3)-K8*INC_b+K9*I_b;
% kgri=Kmax;
% E error covariance matrix
[m,n]=size(residual);
E=inv(jacobian'*jacobian);
% -------------------------------------
% standard deviation of the parameters
%std_K=sqrt(E(1,1));
std_K1=sqrt(E(1,1));
std_K2=sqrt(E(2,2));
std_RaINCb=sqrt(E(3,3));
% std_BETA=sqrt(E(4,4));
% std_K5=sqrt(E(5,5));
% -------------------------------------
% percent coefficient of variation of the estimated parameters
%CV_K=(std_K/K)*100
CV_K1=(std_Gama/Gama)*100;
CV_K2=(std_K8/K8)*100;
CV_RaINCb=(std_M/M)*100;
% CV_BETA=(std_BETA/BETA)*100
% CV_K5=(std_K5/K5)*100
% -------------------------------------
figure(1)
sim('MCBS_project_than',t) % replace 'Nuovo_OGTT_Ela' with the name of your Simulink model
plot(t,GLP1_data_VICT,'ro')
xlabel('time (min)')
ylabel('GLP1 (mmol/L)')
hold on
plot(tout,GLP1out,'k')
figure(2)
plot(t,IL6_data_VICT,'ro')
xlabel('time (min)')
ylabel('insulin (mU/L)')
hold on
plot(tout,IL6mout,'k')
% figure(3)
% plot(t,incretinaOGTT,'ro')
% xlabel('time (min)')
% ylabel('incretin (ng/L)')
% hold on
% plot(tout,INCout,'k')
RMSEogtt=sqrt(resnorm/(3*(length(GLP1_data_VICT))));
Error: File: parameterestim_sana.m Line: 109 Column: 98
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for
mismatched delimiters.

댓글 수: 15

That line has
[bestpar, resnorm, residual, exitflag, output, lmd, jacobian]=lsqnonlin(@fz_costo_sana.m,startpar[0.01 0.01 .01] [10 10 10]options)';
You should never use the .m after a @function . When @ is followed by a name, it is referring to a function and the function is not necessarily implemented by a .m file. Name resolution will be done to find the function.
Using .m would only be done if you were using run() and a character vector or string scalar that was the name of a script.
You also have
startpar[0.01 0.01 .01]
which is invalid. [] is used only to build lists, never to indicate a function call and never to indicate indexing. Perhaps you want a comma between startpar and the list.
That section of your code says
startpar[0.01 0.01 .01] [10 10 10]options
You can only have a [] list directly after another [] list if you are inside a [] list, or if you are inside {} building a cell array. You also cannot have an expression such as options directly after a [] list without an operator between them. MATLAB has no implied multiplication, so if you are wanting to multiply [10 10 10] by options you need to put in the * or .* explicitly.
Hi walter roberson, i'm not able find where you corrected my error can u please tell me.
sir can you please help me by editing my program and share here so i can try it in my system.
[bestpar, resnorm, residual, exitflag, output, lmd, jacobian] = lsqnonlin(@fz_costo_sana, startpar, [0.01 0.01 .01], [10 10 10], options);
Unrecognized function or variable 'option'.
Error in fz_costo (line 109)
[bestpar, resnorm, residual, exitflag, output, lmd, jacobian] = lsqnonlin(@fz_costo_sana, startpar, [0 0
0], [5 5 5], option);
109 [bestpar, resnorm, residual, exitflag, output, lmd, jacobian] = lsqnonlin(@fz_costo_sana, startpar, [0 0 0], [5 5 5], option);
K>>
still same error from that line please help me
the variable name is options with an s, like I posted before.
Undefined function 'fz_costo_new.m' for input arguments of type 'double'.
Error in lsqnonlin (line 206)
initVals.F = feval(funfcn{3},xCurrent,varargin{:});
Error in parameterestim_sana (line 108)
[bestpar, resnorm, residual, exitflag, output, lmd, jacobian] = lsqnonlin(@fz_costo_new.m, startpar, [0 0
0], [5 5 5], options);
Caused by:
Failure in initial objective function evaluation. LSQNONLIN cannot continue.
211 rethrow(userFcn_ME)
K>>
File text clearly marked
Copyright 1990-2019 The MathWorks, Inc.
removed from this comment.
clear
clear global
clc
close all
%format long
global SRex Km Ke V IL6b RaIL6 Tv t_start t_end dataIL6GLP1 t
% -------------------------------------------------------------------------
% NB: GLYCEMIA has to be expressed in (mmol/l
% INSULINEMIA has to be expressed in (mU/l)
% -------------------------------------------------------------------------
scelta=menu('Select case','HC1 (Muscelli)','HC2 (Nauck)');
switch scelta
case 1
% -------------------------------------------------------------------------
% OGTT MUSCELLI DATA NORMO
% E. Muscelli, A. Mari, A. Natali, B.D. Astiarraga, S. Camastra, S. Frascerra, J.J. Holst, E. Ferrannini, Impact of incretin hormones on ?-cell function in subjects with normal or impaired glucose tolerance, Am. J. Physiol. Endocrinol. Metab. 291 (2006) E1144-E1150.
t_start=1;
t=[0 10 20 30 40 60 90 120 150 180];
dataGLP1out=[-0.0611404034260573;0.153761026536856;0.381887441294696;0.577225771343123;0.785935420734692;1.02732340392451;1.28878665794757;1.46511064263731;1.60857337534354;1.75203610804977;1.79782967573179;1.72437887843715;1.63132839759097;1.49215509632929;1.40577198333615;1.31946203761713;1.21963443800674;1.14002844377781;1.05353557987351;0.927440928858545;0.867507785455261;0.788267627596867]';
dataIL6out=[-0.0611404034260573;0.153761026536856;0.381887441294696;0.577225771343123;0.785935420734692;1.02732340392451;1.28878665794757;1.46511064263731;1.60857337534354;1.75203610804977;1.79782967573179;1.72437887843715;1.63132839759097;1.49215509632929;1.40577198333615;1.31946203761713;1.21963443800674;1.14002844377781;1.05353557987351;0.927440928858545;0.867507785455261;0.788267627596867]'*(1/6); %conversion from pmol/l to mU/l
% GIP+GLP1
% incretinaOGTT=[145.716 270.0798 339.5178 329.7588 322.815 318.4284 272.0028 280.0878 284.4702 254.0166]';
SRex = 0.050;
Km= 0.009;
Ke = 0.059;
V = 14;
IL6b =1.7;
RaIL6 = Ke*IL6b*V;
Tv =67;
%t_start= 1;
t_end = 155;
%RaINCb = 217;
%K1= 1;
%K2=0.1;
%t_end=180;
% ----------------------------------------------------------------
case 2
%OGTT NAUCK DATA HEALTHY
% M.A. Nauck, A. El-Ouaghlidi, B. Gabrys, K. Hücking, J.J Holst, C.F Deacon, B. Gallwitz, W.E. Schmidt, J.J. Meier, Secretion of incretin hormones (GIP and GLP-1) and incretin effect after oral glucose in first-degree relatives of patients with type 2 diabetes, Regul Pept. 122 (2004) 209-217.
% t=[0 15 30 45 60 75 90 120 150 180 210 240]';
% glicemiaOGTT=[5.54 8.04 11 11.54 10.64 8.73 7.27 5.73 5.14 4.64 4.63 4.68]';
%insulinemiaOGTT=[45.45 193.9 478.78 654.5 706.06 472.73 318.18 169.7 109.1 60.61 36.36 26.67]'*(1/6); %conversion from pmol/l to mU/l
%GIP+GLP1
%incretinaOGTT=[92.2602 298.347 418.8954 423.4032 431.433 402.3756 370.2276 289.7586 221.4258 178.7952 142.5594 104.3616]';
%Gb = 5.5;
%Ib = 7.6;
%Incb=90;
% k7 ESTIMATED FROM IIVG
%k7=0.158;
%tfinal=240;
% -------------------------------------------------------------------------
end
% -------------------------------------------------------------------------
dataIL6GLP1 = [dataGLP1out dataIL6out];
%FIXED PARAMETERS SIMULATOR
%D = 417; %quantity in mmol equivalent to 75g
%kabs=0.22;
%f=0.90;
% HGB_b=0.76875; % hepatic balance
V=14;
%M_ipog=0.03;
%alfa=1.0;
%p=2;
% K1=(p/(p+1))*HGB_b/((G_b)*V);
% K2=(1/(p+1))*HGB_b/(I_b*V);
%K3=0.0718; % different from zero only when G>10
%K4=0.717; % different from zero only when G>10
%K6=0.1;
%K9=0.1;
%Ra_INC_b=K6*INC_b*V;
%K5 = 6.91;
% ------------------------------------
% initial values for the parameters to be estimated
%K_0=0.013;
K1_0 = 1;
K2_0 = 0.1;
RaINCb_0=217;
% BETA_0=1;
% K5_0 = 25;
startpar = [K1_0 K2_0 RaINCb_0];
% -------------------------------------
options=optimset('Display','Iter','TolFun',1E-20,'TolX',1E-7,'MaxFunEvals',3000,'MaxIter',500)';
[bestpar, resnorm, residual, exitflag, output, lmd, jacobian] = lsqnonlin(@fz_costo_new.m, startpar, [0 0 0], [5 5 5], options);
%bestpar, resnorm, residual, exitflag, output, lmd, jacobian
%K_0=bestpar(1);
K1_0=bestpar(1);
K2_0=bestpar(2);
RaINCb_0=bestpar(3);
% BETA_0=bestpar(4);
% K5_0=bestpar(5);
% beta=-K7*(G_b^1.3)-K8*INC_b+K9*I_b;
% kgri=Kmax;
% E error covariance matrix
[m,n]=size(residual);
E=inv(jacobian'*jacobian);
% -------------------------------------
% standard deviation of the parameters
%std_K=sqrt(E(1,1));
std_K1=sqrt(E(1,1));
std_K2=sqrt(E(2,2));
std_RaINCb=sqrt(E(3,3));
% std_BETA=sqrt(E(4,4));
% std_K5=sqrt(E(5,5));
% -------------------------------------
% percent coefficient of variation of the estimated parameters
%CV_K=(std_K/K)*100
CV_K1=(std_Gama/Gama)*100;
CV_K2=(std_K8/K8)*100;
CV_RaINCb=(std_M/M)*100;
% CV_BETA=(std_BETA/BETA)*100
% CV_K5=(std_K5/K5)*100
% -------------------------------------
figure(1)
sim('MCBS_project_than',t) % replace 'Nuovo_OGTT_Ela' with the name of your Simulink model
plot(t,GLP1_data_VICT,'ro')
xlabel('time (min)')
ylabel('GLP1 (mmol/L)')
hold on
plot(tout,GLP1out,'k')
figure(2)
plot(t,IL6_data_VICT,'ro')
xlabel('time (min)')
ylabel('insulin (mU/L)')
hold on
plot(tout,IL6mout,'k')
% figure(3)
% plot(t,incretinaOGTT,'ro')
% xlabel('time (min)')
% ylabel('incretin (ng/L)')
% hold on
% plot(tout,INCout,'k')
RMSEogtt=sqrt(resnorm/(3*(length(GLP1_data_VICT))));
Error in lsqnonlin (line 206)
initVals.F = feval(funfcn{3},xCurrent,varargin{:});
I already told you what the problem is, and I already told you the solution and gave an exact version of the code.
You have @fz_costo_new.m and you need to change that to @fz_costo_new
NEVER put the .m after a @ like that. You are not giving the name of a file at that point!
sir after delect that also im facing error

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

추가 답변 (1개)

[bestpar, resnorm, residual, exitflag, output, lmd, jacobian] == lsqnonlin (@ fz_costo_sana, startpar [0.01 0.01; .01] [10 10 10] options) ';
no .m

카테고리

도움말 센터File Exchange에서 Multicore Processor Targets에 대해 자세히 알아보기

제품

릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by