Undefined variable problem in a simple model for non-linear oscillator
Ältere Kommentare anzeigen
Hey guys, I'm just trying to run a very simple function to help model a non-linear oscillator. Here's the code:
function vp=F(t,v);
vp=zeros(2,1);
vp(1)=v(2);
vp(2)= -(v(2)+v(1)+3*(v(1))^3)+20*cos(w*t);
I had to transform it into a 1st order eq b/c it seems like matlab can't handle second order equations for some reason. When I type in the following, I get an error saying "undefined function or variable 't'"
%[t,v]=ode45('F',[0,15],[0,0])
plot(t,v(:,1))
I'm not experienced with MatLab at all! Any help would be greatly appreciated.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!