Analyzing Falling Object w/ Linear Friction: Troubleshooting Code

Click For Summary
SUMMARY

The discussion focuses on troubleshooting a MATLAB code for analyzing the motion of a falling object with linear friction. The original code encounters an error due to incorrect usage of the exponential function. The solution provided involves replacing the erroneous 'e' with 'exp' or using element-wise operations with the dot operator. The corrected line of code is: x=(m/b)*(g*t + exp(-b*t/m)); which successfully computes the position of the object over time.

PREREQUISITES
  • Understanding of MATLAB syntax and functions
  • Familiarity with basic physics concepts, specifically linear motion and friction
  • Knowledge of vector operations in MATLAB
  • Experience with plotting data in MATLAB
NEXT STEPS
  • Learn about MATLAB's element-wise operations and their significance
  • Explore the physics of motion under the influence of friction
  • Study MATLAB's plotting functions for better data visualization
  • Investigate numerical methods for solving differential equations in MATLAB
USEFUL FOR

Students in physics or engineering, MATLAB programmers, and anyone interested in simulating motion with friction in computational environments.

Raziel2701
Messages
128
Reaction score
0
It's an object that's falling from rest. The equation takes into account linear friction. in any case, this is is my code or program of whatever it is called:

m=80;%Mass of ignorance
g=9.8;%Gravity
beta=1.6*10^-4;%Given coefficient for air at STP
D=.4;%Diameter of Palin, assuming she's a spherical object
b=beta*D;%Coefficient of linear friction
t=0:.2:60;


x=(m./b)*(g*t + e^(-b*t./m));

plot(t,x)
grid on
xlabel('time','FontSize',16)
ylabel('Position of Sarah Below Helicopter','FontSize',16)

I get this error:
Error in ==> HW13myprogram at 10
x=(m./b)*(g*t + e^(-b*t./m));

What am I doing wrong?
 
Physics news on Phys.org


replace your equation with

x=(m/b)*(g*t + e.^(-b*t/m));
 


It worked fine for me with:

x=(m./b)*(g*t + exp(-b*t./m));
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
5
Views
8K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K