Interp1-Input coordinates must be real.
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Matlab gives this error. SOC_ent and DUdt is both array with constant terms and theta_n is changing. But non of the terms are complex it gives must be real error.
dudT= interp1(SOC_ent,dUdt,theta_n,'linear','extrap');
Error using matlab.internal.math.interp1
Input coordinates must be real.
Error in interp1 (line 154)
VqLite = matlab.internal.math.interp1(X,V,method,method,Xqcol);
Error in ode_spmet_degr_cycle (line 85)
dudT= interp1(SOC_ent,dUdt,theta_n,'linear');
Error in spmet>@(t,x)ode_spmet_degr_cycle(t,x,data,p,dUdt,SOC_ent) (line 43)
[ts,x] = ode23s(@(t,x) ode_spmet_degr_cycle(t,x,data,p,dUdt,SOC_ent),t,x0,Opt1);
Error in ode23s (line 362)
f1 = feval(odeFcn, t + 0.5*h, y + 0.5*h*k1, odeArgs{:});
Error in spmet (line 43)
[ts,x] = ode23s(@(t,x) ode_spmet_degr_cycle(t,x,data,p,dUdt,SOC_ent),t,x0,Opt1);
Error in Untitled (line 51)
[c_p,c_n,eps,delta_sei,V,R_tot_n,theta_n,c_ss_n,c_ss_p,T1,dudT,theta_p]= spmet(p,t,I,Uni,Upi,deltasei0,eps0,Ti);
0 Commenti
Risposte (1)
Bjorn Gustavsson
il 24 Nov 2020
Then it must be because your theta_n has become complex. How that came to be is impossible to guess based on this information. If you use the debugger you can step up into your ODE-function and inspect its state when the error happens. A blind guess is that you have some terms (with something like square roots or logs) that should be positive but has become negative. Perhaps you can avoid this by setting the ode-options for nonnegative solutions, perhaps you have to make bigger changes to the ODE.
HTH
0 Commenti
Vedere anche
Categorie
Scopri di più su Spline Postprocessing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!