Ski Jump HELPPPP
1 次查看(过去 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)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!