From: bullion on
Hi all,

I have been having a problem in making a plot in matlab.

using an expression for acceleration

a=-c*v^2-d

where c and d are constants and v is the starting velocity. I am trying to find a way of making an expression so a plot of velocity vs time can be made.

Takes two seconds for me to do in excel, am really struggling to find a way of doing this in matlab.

Regards
From: Steven Lord on

"bullion " <christophbullion(a)gmail.com> wrote in message
news:hpi0j6$ben$1(a)fred.mathworks.com...
> Hi all,
>
> I have been having a problem in making a plot in matlab.
>
> using an expression for acceleration
>
> a=-c*v^2-d
>
> where c and d are constants and v is the starting velocity. I am trying to
> find a way of making an expression so a plot of velocity vs time can be
> made.
>
> Takes two seconds for me to do in excel, am really struggling to find a
> way of doing this in matlab.

Since acceleration is the derivative of velocity with respect to time, you
have:

v' = c*v^2-d

So you want to use an ODE solver. Try ODE45 first. HELP ODE45 will give
you some examples you can use as a template for solving this problem.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


 | 
Pages: 1
Prev: Entry Point Not Found
Next: Matlab COM Interface