Ski Jump HELPPPP
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to design this:
The ski jump starts at a height of h feet and finishes at a launch point height of eh feet, where height is represented by the variable y. From the start (x = 0) to the launch point, the ski jump extends a horizontal distance of d feet. A skier using the jump will begin horizontally and will fly off the end at a sa degree angle from the horizontal. Develop the set of equations to determine the four coefficients of a cubic polynomial y = f(x) for the side
view of the ski jump that meets the specifications above. Write a script to compute and display these coefficients, using methods described in class to solve a set of linear equations.
I want to plot this as well.
Here's my code, its effed up though I need help on assigning these values because every try is a failure!
A = [ 0 0 0 1 ];
d^3 d^2 d 1;
0 0 1 0;
3*d^2 2*d 1 0];
b = [100; 10; 0; tan(30*pi/180)];
format short e;
c = A\bx == 0:d;
y = polyval(c,x);
plot(x,y)
댓글 수: 0
답변 (2개)
Walter Roberson
2012년 5월 1일
Try removing the ']' from the first line. And make sure you define d before that first line.
You need to define your variable "bx".
Why are you comparing A\bx to the vector of integers from 0 to d ?
댓글 수: 0
Leah
2012년 5월 1일
I'm pretty sure you want to set up A as the system of linear equations like this
A=[0 0 0 1; 1 1 1 1; 0 0 1 0; 3 2 1 0]
b = [100; 10; 0; tan(30*pi/180)];
c=A\b
d=4*pi
x=1:.1:d
y = polyval(c,x);
plot(x,y)
It also seems that x=0:d, the range you want to evaluate your polynomial over. I'm not sure what that is so i made up some numbers.
Like Walter said always make sure you define variable in the right order. You can't use them until you create them.
댓글 수: 2
Rahul Karelia
2020년 9월 22일
Thank you leah, can u show what kind of Graph you get when you run this Code ?
Image Analyst
2020년 9월 22일
It works, did you try it Rahul?
A = [0 0 0 1; 1 1 1 1; 0 0 1 0; 3 2 1 0]
b = [100; 10; 0; tan(30*pi/180)];
c = A\b
d = 4*pi
x = 1:.1:d
y = polyval(c,x);
plot(x,y, 'b-', 'LineWidth', 2);
xlabel('x', 'FontSize', 22);
ylabel('y', 'FontSize', 22);
title('y vs. x', 'FontSize', 22);
grid on;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/364342/image.png)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polynomials에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!