Question

Write a Matlab Function (not a script) that performs a single iteration of the Euler's method...

Write a Matlab Function (not a script) that performs a single iteration of the Euler's method for the regular parashot problem, (i.e. just write a function that calculates v_next)
Assume:
cd = 0.25 [kg/m] for t < 10sec and
c
d = 1.5   [kg/m] for t ≥ 10sec

Hint: use only if-statements, do not use any LOOPs you only need to compute only one iteration
Hint2: make sure you define the inputs and outputs of the function correctly

Please show how to write this code. (Does not need to be in MatLab, I just need a general idea of how to start)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

The below bold part is the function and the rest is just to run that function


Euler1(1,1,100,0.1)


function v_next=Euler1(t0,v0,m,h)
v_next=0;
g=9.81;
if(t0<10)
v_next=v0+(g-0.25/m*v0)*h;
else
v_next=v0+(g-1.5/m*v0)*h;
end
end

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Write a Matlab Function (not a script) that performs a single iteration of the Euler's method...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1) Explain the IDFT function in Matlab 2) Re-write a SCILAB script that performs the IDFT....

    1) Explain the IDFT function in Matlab 2) Re-write a SCILAB script that performs the IDFT. 3) Test your program using the following input xk (6-1-40-1)); 4) Plot x 5) Compare the output of Matlab with the output of SCILAB

  • Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called...

    Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called isright, that takes three inputs, a, b, and c, and determines whether they are could be the lengths of the sides of a right triangle; the output, y, will be set equal to the following: i). -1 if at least one of the values is not positive. Also, only for this case, have the function print out an error message, which states "At least...

  • matlab The Homework should be submitted as a script (.m) file Write a script areaMenu that...

    matlab The Homework should be submitted as a script (.m) file Write a script areaMenu that will print a menu consisting of "Cylinder," "Circle," and "Rectangle." It waits for the user to choose from the menu then call the corresponding function of each choice as follows: 1- Cylinder will call the function (cyl) which prompts the user for the radius and height of the cylinder, then calculates and prints area of the cylinder. 2- Circle will call the function (cir)...

  • Write a function-function in MATLAB that use's Euler's Method to determine a numerical solution for a...

    Write a function-function in MATLAB that use's Euler's Method to determine a numerical solution for a 1st-order ordinary differential equation with one dependent variable using the following line where dt = time step t0 = initial time tf = final time y0 = dependent variable for initial value function [t, y) = EulerIdydt, dt, to, tf, yo] dydt = dydt(t, y)

  • Write a MATLAB function/script that performs the following tasks. Approximate: 2+2 (a) Using the composite Trapezoidal...

    Write a MATLAB function/script that performs the following tasks. Approximate: 2+2 (a) Using the composite Trapezoidal rule with n=8 (b) Using the composite Simpson's rule with n = 8 (c) Display the final solution for each method along with the exact solution. Name your file: WS5_LastName_First Inital()

  • MATLAB Only MATLAB Only MATLAB Only Indicated in the script below, write a function, called arbpoly3,...

    MATLAB Only MATLAB Only MATLAB Only Indicated in the script below, write a function, called arbpoly3, that accepts two inputs: i) a row vector, called c, containing the coefficients of the polynomial, starting with the coefficient for the lowest degree term, which is the constant term. ii) a row vector, called x, which is the set of real numbers where the polynomial is to be evaluated. The output, y, will be a vector containing the values of the polynomial, evaluated...

  • read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates th...

    read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates the BMI using the equation below, displays the BMI category, and outputs the BMI value tothe user's program W (kg) h2 (m2) BMI Display Normal if 18.5 s BMI 25 Display Overweight if 25 s BMI <30 Display Obese if BMI 2 30 Else display underweight So you will create two...

  • Numerical method question 7. Write a script as a user-defined function with the function name of...

    Numerical method question 7. Write a script as a user-defined function with the function name of "Cal Press [YOUR WSU IDI", to determine the gas pressqre of the system, p [Pa], using the ideal gas law for given volume V[m], temperature, T[K], molé, N. NOTE: you need to save this script as "Cal_Press_lYOUR WSU ID].m". You may want to review an article to solve the problem https://en.wikipedia.org/wiki/Ideal_gas_law). Use V 0.1 m3, T- 300 K, N- 1 mole (2 pt) emplate...

  • Write a script in matlab that prompts the user to input the day, month, and year;...

    Write a script in matlab that prompts the user to input the day, month, and year; determine the day of the year (the number of days including the current day). Be sure to take leap year into account. Use a for loop Test your code on the following dates: February 28, 2015 April 9, 1976 October 12, 1887 Create a script that performs the same function as repmat. The only built-in commands you may use are input, size, and disp.

  • DO THIS IN MATLAB PLEASE DO THIS IN MATLAB Create a script file that performs the...

    DO THIS IN MATLAB PLEASE DO THIS IN MATLAB Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately. For this project, do not have your homemade functions fprintf anything, instead have all your fprintf commands within your script. Attach your published script file along with .m files for your functions. Exercise 1. A fundamental iterative method for finding the roots of equations of one-variable is known as Newton's...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT