Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: diff eq
Replies: 8   Last Post: Apr 11, 2013 2:27 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Guest

Watch Watch this User
Re: diff eq
Posted: Apr 10, 2013 6:16 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello

I am doing as you posted and calling ode45 from a different mfile. In my code I am really using a's instead of x's, does that cause a problem?

So when I run the first file which is this:
function da = system_ex(t,a)
da(1) = -2.4712*a(1) + 0.005*a(2) + 0.56*a(3)+ 0.1*a(4);
da(2) = 0.385*a(1) - 0.1002*a(2)
da(3) = 0.002*a(2) - 0.6462*a(3)
da(4) = 0.007*a(2) - 0.2042*a(4)
It is still saying input argument 'a' is undefined.

but the a(t) is what I am trying to find. In a way I think I'm defining 'a' with this file, what's wrong with this part?

and for my second mfile, when I am calling ode45 it wont run probably due to 'a' function being undefined
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <kjtnkm$ro7$1@newscl01ah.mathworks.com>...
> "richard " <richard7893@embarqmail.com> wrote in message <kjrsih$mgb$1@newscl01ah.mathworks.com>...
>

> >
> > this is what I am typing into MATLAB:
> > function dx = system_ex(t,x)
> > dx = zeros(4,1);
> > dx(1) = -2.4712*x(1) + 0.005*x(2) + 0.56*x(3)+ 0.1*x(4);
> > dx(2) = 0.385*x(1) - 0.1002*x(2)
> > dx(3) = 0.002*x(2) - 0.6462*x(3)
> > dx(4) = 0.007*a(2) - 0.2042*x(4)
> > [T,X] = ode45(@systems_ex,[0 10],[1 0 0 0])
> > plot(t,x(:,1))
> >

>
> I hope you save system_ex in an mfile and call ode45 on another mfile. You seem to put everything in the same mfile.
>
> Bruno



Date Subject Author
4/7/13
Read diff eq
Guest
4/8/13
Read Re: diff eq
Bruno Luong
4/10/13
Read Re: diff eq
Guest
4/10/13
Read Re: diff eq
Torsten
4/10/13
Read Re: diff eq
Guest
4/10/13
Read Re: diff eq
Torsten
4/10/13
Read Re: diff eq
Bart
4/11/13
Read Re: diff eq
Torsten
4/10/13
Read Re: diff eq
richard

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.