Re: switchcase problem in R12 v6.1
- From: "Titus Edelhofer" <titus.edelhofer@xxxxxxxxxxxx>
- Date: Wed, 5 Oct 2005 17:45:53 +0200
Hi,
the error message tells you what's wrong: ode15s gives t, c, and flag
to your function trial. flag has the value 'init', which is not handled by
your function, so you should write something like
function varargout= trial (t, c, flag)
switch flag
case 'init'
varargout{1}=<your initial value comes here>;
....
Titus
"sarma" <sarma_418@xxxxxxxxxxx> schrieb im Newsbeitrag
news:ef17218.-1@xxxxxxxxxxxxxxxxxxx
> iam encountering a strange problem using switch case. i'am trying
> call a function named trial (trial.m) and calling it from command
> prompt using ode15s, but i get a error saying unknown flag 'init'.
> MATLAB6.1 R12
>
> details given below::::::PLZ help me out:::::::::
>
> M-file name trial
>
> function varargout= trial (t, c, flag)
>
> switch flag
> case ''
> varargout{1}=f(t,c);
>
> case 'jpattern'
>
> varargout{1} = jpattern(t,c);
>
> case 'mass'
>
> varargout{1} = mass(t,c);
> otherwise
>
> error(['Unknown flag ''' flag '''.']);
> end
> % ------------------------------------------------------------
>
> function S = jpattern(t,c)
> %code for jpattern
>
> %---------------------------------------------------------------
>
> function M = mass(t,c)
> %code for mass
> %---------------------------------------------------------------
>
> function Gi=jacobianri(t,cp)
> %code for jacobianri
> %---------------------------------------------------------------
>
> while running at command prompt!!
>
> options=odeset('OutputFcn','odeplot','OutputSel',[ind],'JPattern','on'
> ,'Mass','on');
>
> [t c Y]= ode15s('trial',[0 ta], cinit,options);
>
> ----------------------------------------------------------------
> ERRORS Encountered!!!!
>
> ??? Error using ==> trial
> Unknown flag 'init'..
>
> Error in ==>
> E:\MATLAB\toolbox\matlab\funfun\private\odearguments.m
> On line 53 ==> [def_tspan,def_y0,def_options] =
> feval(ode,[],[],'init',extras{:});
>
> Error in ==> E:\MATLAB\toolbox\matlab\funfun\ode15s.m
> On line 212 ==> [neq, tspan, ntspan, next, t0, tfinal, tdir, y0,
> f0, args, ...
>
> Error in ==> ..\test.m
> On line 61 ==> [t c Y]= ode15s('trial',[0 ta],
> cinit,options,flag);
.
- References:
- switchcase problem in R12 v6.1
- From: sarma
- switchcase problem in R12 v6.1
- Prev by Date: Re: nonlinear optimization
- Next by Date: Save line() to RGB image
- Previous by thread: switchcase problem in R12 v6.1
- Next by thread: Undefined function or variable 'maple' message
- Index(es):
Relevant Pages
|
|