ODE45 error message "Error using exist The first input to exist must be a string scalar or character vector"
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Khanif Eko Prasetyo
le 5 Fév 2019
Commenté : Khanif Eko Prasetyo
le 5 Fév 2019
Below is my code to solve a population balance:
global param w0 w
param0=[1 1 1 1]
param=param0
param=fminsearch(lau,param0)
psi_lau=param(1)
alfa_lau=param(2)
beta_lau=param(3)
epsilon_lau=param(4)
function sse=lau(param)
global param w0 w t
w0=[0.1 0.2 0.23 0.4 0.2 0.1 0.1 0.01];
w=w0
t0=[0 0 0 0 0 0 0 0];
tp=[5 5 5 5 5 5 5 5];
t=t0
[t,w]=ode45(grinding,[t0 tp],w0)
wdata= [1 1 1 1 1 1 1 1 ; % weight fraction pada t=60
1 1 1 1 1 1 1 1 ; % weight fraction pada t=120
1 1 1 1 1 1 1 1 ; % weight fraction pada t=180
1 1 1 1 1 1 1 1 ; % weight fraction pada t=240
1 1 1 1 1 1 1 1 ]; % weight fraction pada t=300
%w= (2*param(1)^2).*wdata; % weight fraction hasil simulasi
sse=sum(sum((wdata-w).^2)'); % sums of square error
end
function dwdt=grinding(t,w)
global param w0 w
x=[0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2];
w
param
for k=1:length(x)
S(k)=(param(2)*x(k)^param(3))/(1+x(k)^param(4));
for u=2:k
deltaB(k,u)=((x(k-1))/x(u))^param(1)-((x(k)/x(u))^param(1));
end
end
for k=1:length(x)
WS(k)=w(k).*S(k);
end
S
deltaB
summation=WS*deltaB
for k=1:length(x)
dwdt(k)=summation(k)-S(k)*w(k);
end
dwdt
end
It trigger an error of
Error using exist
The first input to exist must be a string scalar or character vector.
Error in odearguments (line 59)
if (exist(ode)==2)
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in Optimize>lau (line 26)
[t,w]=ode45(grinding,[t0 tp],w0)
Error in Optimize (line 8)
param=fminsearch(lau,param0)
Could anybody help to solve the issue, sorry to put a lot of tracker for debuging purpose, thanks
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!