Question

I need to make a model in MATLAB for free-fall using Euler method. g=9.81 (gravitational acceleration)...

I need to make a model in MATLAB for free-fall using Euler method.

g=9.81 (gravitational acceleration)

c=12.5 (drag coefficient)

m= 68.1 (mass)
h=0.1 (step size)

v(0)=0 (Velocity is 0 at time zero)

t=[0:100]*h (100 steps)

Vnew= vt+(g-(c/m)*v)*h (this is the equation for the velocity at each subsequent step

I want to use a "for" loop in MATLAB but i don't know how to write it properly. Could anyone help me?

Homework Answers

Answer #1

======>>>>Matlab Script<<<<=====

clc
clear all
h=0.1; % Step size
g=9.81; % Given data
c=12.5; % Given data
m=68.1; % Given data
v(1)=0; % The initial velocity value
N=100; % Total no of steps
t=0:1:100; % The time values

for n=1:N % For each subsequent time value
v(n+1)=v(n)*t(n)+(g-(c/m)*v(n))*h;
fprintf('\nvelocity after %d second = %1.3g',n,v(n+1))
end

Now the screenshot of Matlab script and output file attached below.

Output ====>>

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions