MATLAB Answers

Error:undefined variable in trapezoidal integration

2 views (last 30 days)
Yo mama
Yo mama on 28 Apr 2020
Commented: Rena Berman on 14 May 2020
Ok this is driving me crazy because it seems so simple. All i need to do is integrate from t=0 and t=3. I have the following function and the comments are what I put into the command window. I need to integrate the ydot vector but once I put it in the function is says that ydot is not defined like what.

Sign in to comment.

Answers (1)

Brian Iwatake
Brian Iwatake on 28 Apr 2020
If you "clear all", then ydot is not there anymore, right?
Yo mama
Yo mama on 30 Apr 2020
  1. my step size was fixed for the question being asked, the result of my integration was compared to my runge-kutta result for the distance at 3 seconds and I got a percent error of less than one percent - so I think it was spot on, my code only worked when I ran a Sys2ODEsRK4 function as well in another window. My step size needed to be 0.1 explicitely.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!