From: Walter Roberson on
OH wrote:
> I thinks the reason why ode functions do not use end statements.
> 1. not fortran compiler As far as I know about fortran, end statements
> need to designate the end of program. But, Matlab do not need those
> command mendatory.

But that is not a reason to _not_ use a final 'end' statement,
especially since Matlab can do better optimization if you put the final
'end' statement in.

> 2. ode function related to odesolver command and do not open any
> function like for, if statement.

There is no reason why an 'if' or 'for' could not be used, if that made
the calculations easier.

> How do you think about my comment?

I still do not see any reason to avoid adding the 'end' statement. If
the 'end' statement shoud to be avoided, then there should be a reason,
such as "it makes the calculation slower", or "you cannot do <this> if
you have an 'end' statement and you often need to do that in ode code."
(There are a few things you cannot do if you add the 'end', having to do
with eval() and load() and assignin().)
From: Roman Tolmachev on
Walter Roberson <roberson(a)hushmail.com> wrote in message <EqlJn.28017$wV2.1965(a)newsfe23.iad>...
> OH wrote:
> > I thinks the reason why ode functions do not use end statements.
> > 1. not fortran compiler As far as I know about fortran, end statements
> > need to designate the end of program. But, Matlab do not need those
> > command mendatory.
>
> But that is not a reason to _not_ use a final 'end' statement,
> especially since Matlab can do better optimization if you put the final
> 'end' statement in.
>
> > 2. ode function related to odesolver command and do not open any
> > function like for, if statement.
>
> There is no reason why an 'if' or 'for' could not be used, if that made
> the calculations easier.
>
> > How do you think about my comment?
>
> I still do not see any reason to avoid adding the 'end' statement. If
> the 'end' statement shoud to be avoided, then there should be a reason,
> such as "it makes the calculation slower", or "you cannot do <this> if
> you have an 'end' statement and you often need to do that in ode code."
> (There are a few things you cannot do if you add the 'end', having to do
> with eval() and load() and assignin().)
Thank you guys for so much attention for my code)) Personally, I believe that 'end' should be in the code, since I also don't see any reasons not to write it. It doesn't affect the speed of calculations, and what does is one wrong coefficient in the equation, which I wrote with mistake.
P.S. May be some of you know, how can one create an .exe file from Matlab? I mean some gui compiled into a stand-alone application to run on another computer where Matlab is not installed? I think there should be some package also that the client has to install before running such an application.
From: Walter Roberson on
Roman Tolmachev wrote:

> P.S. May be some of you know, how can one create an .exe file from
> Matlab? I mean some gui compiled into a stand-alone application to run
> on another computer where Matlab is not installed? I think there should
> be some package also that the client has to install before running such
> an application.

You need the Matlab Compiler product. It is not really a compiler: it is
really a deployment tool, producing an executable that runs no faster
than Matlab itself. It is, though, fine for producing something that
runs on the machine of someone that does not have Matlab, and it does
not require that the people have a Matlab license (within certain limits.)
From: Steven Lord on

"Walter Roberson" <roberson(a)hushmail.com> wrote in message
news:ht1ejt$h60$2(a)canopus.cc.umanitoba.ca...
> OH wrote:
>> You should be
>> function dx=lorenzeqs(t,x)
>> sigma=10; b=8/3;
>> dx=zeros(3,1);
>>
>> dx(1)=sigma*(x(2)-x(1));
>> dx(2)=x(1)*(28-x(3))-x(2);
>> dx(3)=x(1)*x(2)-b*x(3);
>>
>> Usually, ODE function do not use end statements.
>
> That's an interesting remark. Is there any reason why an ODE function
> should *not* use an 'end' statement?

Just keep in mind that if ANY of the functions in a file end with an END
statement (that's matched with the initial FUNCTION keyword) then they ALL
need to end with an END (at least that's been the case since nested
functions were introduced.)

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


First  |  Prev  | 
Pages: 1 2 3
Prev: line by line subtraction
Next: Wavrecord