3rd order polynomials in MATLAB?

22 次查看(过去 30 天)
Teddy Xiong
Teddy Xiong 2012-10-19
Need help with problem. I am very confused. Don't know where to start and this question is very hard for me. I tried getting started with
function[coeff lp fd] = SkiJump(l,h0,hf,s0,sf)
coeff=[]
lp= minmax(SkiJump)
fd= hf-20
plot(h0,s0)
but I am just too confused. I missed class due to sickness and i still have to turn in my homework and now I have no idea how to do anything concerning linear equations.
THis is the question
You have been hired as an intern at a ski resort. Your first intern project is to create a new design for a ski jump. Your boss is a big fan of 3rd order polynomials and therefore wants you to design the ski jump based on a 3rd order polynomial. For initial design purposes, your boss wants you to write a MATLAB function called SkiJump which will be used to evaluate the feasability of the design.
The equations of the 3rd order polynomial H(x) and the slope s(x) are defined below:
H(x)=p3x3 +p2x2 +p1x+p0
s(x) = 3p3x2 + 2p2x + p1
*The function header should look like the following:*
function [coeff lp fd] = SkiJump(l,h0,hf,s0,sf)
The inputs to the function are:
the horizontal distance from the start to the launch point (in feet).
h0: the initial height (in feet).
hf: the final height (in feet).
s0: the initial slope (in feet/feet). Must be less than or equal to zero.
sf: the final slope (in feet/feet). Must be greater than or equal to zero.
The outputs from the function are:
coeff: a vector containing the coefficients of the 3rd order polynomial. The coefficients
must be arranged from p3 to p0.
lp: the lowest point of the ski jump design.
fd: the ski jumper’s flying distance.
*To calculate fd assume the following:*
(a) Gravitational acceleration = 32.1522 ft/s2
(b) Neglect ground and air frictions and use conservation of energy in determining the speed of the skier when he/she leaves the jump.
(c) Assume that the ground is at height hf-20 feet.
In addition, the function should also plot the shape of the new ski jump, which is given in figure 1.

回答(2 个)

Image Analyst
Image Analyst 2012-10-19
Take a look at polyfit() and polyval(). You may also find interp1() helpful.
  2 个评论
Dr. Seis
Dr. Seis 2012-10-19
编辑:Dr. Seis 2012-10-19
I don't think polyfit or interp1 will be able to take into account both the height and slope information simultaneously... or will they?
Image Analyst
Image Analyst 2012-10-19
I don't know - I didn't go over it in detail. I just saw something about trying to get coefficients from a 3rd order polynomial so polyfit() popped into mind.

请先登录,再进行评论。


Dr. Seis
Dr. Seis 2012-10-19
编辑:Dr. Seis 2012-10-19
My answer for a different, but similar question might help (at least for the function for the ramp):

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by