MATLAB Help me Solve MATLAB Projectile Problem & Write an m-file

  • Thread starter Thread starter faust9
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion centers on a user's struggle with MATLAB for a projectile problem assignment, highlighting their lack of experience with the software. They seek assistance in writing an m-file and specifically mention difficulties with the ODE45 function. The user expresses frustration with the help documentation, finding it inadequate for beginners. They provide a basic example of an m-file structure and demonstrate how to define a function and create a vector. Overall, the thread emphasizes the need for beginner-friendly guidance in MATLAB.
faust9
Messages
690
Reaction score
2
ARGH! Matlab trouble!

Ok, I'm having a big problem as described here: https://www.physicsforums.com/showthread.php?t=46950

Basically, I've never used MATLAB and was given an assignment on friday which requires that I use matlab. First off, could someone please help me with my projectile problem?

Next, how the heck does one write an m-file. I know how to open the editor and the simple stuff but actually using ODE45 is killing me. The help file is about as useful as a man file--good for pro's lousy for novices.

Any help would be greatly appreciated.
 
Physics news on Phys.org
If you haven't already figured it out, there's nothing much to an .m file. Since i do not warez matlab, I'm using vim (a text editor) and octave. Basically what goes in a .m file is something like this
Code:
function returnValue = f(x)
     returnValue = 2*x^2 + 3*x+2
end

format long %for displaying more digits
result1 = f(4)
results = zeros(1,10); %creates a vector full of zeros, 10 big
results(1) =  f(6);
results(5)  = f(24);
 

Similar threads

Replies
2
Views
4K
Replies
7
Views
4K
Replies
1
Views
4K
Replies
1
Views
3K
Replies
3
Views
3K
Back
Top