MATLAB Matlab help User defined function

  • Thread starter Thread starter qiyan31
  • Start date Start date
  • Tags Tags
    Function Matlab
Click For Summary
The discussion centers on a user-defined function for calculating height based on time, initial velocity, and angle. The function, defined as Height(t,V,Theta), utilizes the formula Ht=V*t*sin(Theta)-4.9*t.^2. A user encounters an error stating that "V" is undefined when testing the function. Another participant asks for the exact command used to test the function, indicating that the function works correctly for them. The focus is on troubleshooting the undefined variable issue in the context of using the function.
qiyan31
Messages
3
Reaction score
0
I made a user-defined function for Height.
function Ht=Height(t,V,Theta);
Ht=V*t*sin(Theta)-4.9*t.^2;
end

V is initial velocity, and i kept on getting input "V" is undefined.
Can someone help me please!
 
Physics news on Phys.org
Works fine for me. What is the precise command that you're using to test the function?
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
6
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K