Analyzing Falling Object w/ Linear Friction: Troubleshooting Code

In summary, the conversation is about a code or program that calculates the position of an object falling from rest, taking into account linear friction. The code uses variables such as mass, gravity, and coefficients for air and friction, and plots the position over time. The error mentioned is caused by using the wrong syntax in the equation. The correct equation should use the exponential function, either "e^" or "exp()", to calculate the position.
  • #1
Raziel2701
128
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
  • #2


replace your equation with

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


It worked fine for me with:

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

1. How do you troubleshoot code for analyzing falling objects with linear friction?

To troubleshoot code for analyzing falling objects with linear friction, you should first check for any syntax errors or typos in your code. Next, make sure all variables are properly declared and initialized. Then, review your calculations and equations to ensure they are accurate and match the desired outcome. Additionally, you can use debugging tools or print statements to track the values of variables and identify any errors in your code.

2. What are some common errors encountered when analyzing falling objects with linear friction?

Some common errors encountered when analyzing falling objects with linear friction include incorrect variable values, incorrect mathematical calculations, and missing or incorrect units. Other errors may arise from typos, missing or misplaced parentheses, or using the wrong formula for the specific scenario. It is important to carefully review your code and calculations to identify and correct any errors.

3. How do you account for linear friction in your code for analyzing falling objects?

To account for linear friction in your code, you can use the formula Ff = μN, where Ff is the force of friction, μ is the coefficient of friction, and N is the normal force. This formula can be used to calculate the frictional force acting on the object and then be incorporated into your equations for acceleration and velocity. Additionally, you can use the concept of work and energy to account for the effects of friction on the object's motion.

4. What factors can affect the accuracy of the code for analyzing falling objects with linear friction?

The accuracy of the code for analyzing falling objects with linear friction can be affected by various factors such as the accuracy of input values, the precision of mathematical calculations, and the inclusion of all relevant forces and factors in the equations. Additionally, the chosen algorithm or approach for solving the problem can also impact the accuracy of the code. It is important to thoroughly test and review the code to ensure its accuracy.

5. Can linear friction be ignored in the code for analyzing falling objects?

In most cases, linear friction cannot be ignored in the code for analyzing falling objects. Friction is a force that opposes the motion of an object and can significantly affect its acceleration and velocity. Ignoring friction in the code can result in inaccurate predictions and may not reflect real-world scenarios. However, if the coefficient of friction is extremely small or the object is moving at a very high speed, the effects of linear friction may be negligible and can be ignored in the calculations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Classical Physics
Replies
17
Views
917
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
3
Views
877
  • Engineering and Comp Sci Homework Help
Replies
7
Views
820
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
7K
  • Differential Equations
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
Back
Top