Polynomial angle definition in boundary conditions help

조회 수: 6 (최근 30일)
João
João 2017년 12월 5일
편집: Roger Stafford 2017년 12월 6일
Hello, I need help figuring out how to write a piece of code to define a polinomial. I have 2 points (x1,y1 and x2,y2), 2 angles (a1 and a2) and an area (Area) as boundary conditions. The shape I need the polinomial to make is a curve leaving from x1 at an angle of 0 degrees and arriving at x2 with an angle of 90 degrees. The help I need is to bypass the tan(90) problem. I know that matlab tan works with radians. The points, angles and area are user defined and will change at each iteration, but the angles will reach 90 degrees.
I made the code like this:
A = zeros(5,5); B = zeros(5,1);
A(1,:)=[x1^4 x1^3 x1^2 x1 1] B(1)=y1
A(2,:)=[4*x1^3 3*x1^2 2*x1 1 0] B(2)=a1
A(3,:)=[x2^4 x2^3 x2^2 x2 1] B(3)=y2
A(4,:)=[4*x2^3 3*x2^2 2*x2 1 0] B(4)=a2
A(5,:)=[integral between x1 and x2] B(5)=Area
and then I proceed to calculate the coefficients and plot the function for different values.
When a2 is 90 degrees or pi/2, how do I make it run smoothly without crashing?
Thanks guys
  댓글 수: 1
Roger Stafford
Roger Stafford 2017년 12월 6일
편집: Roger Stafford 2017년 12월 6일
I am guessing that you might solve your problem by creating a parametric curve that satisfies your boundary conditions. That way you would have no trouble with infinite slopes. If x and y are each given as cubic, or possibly fourth-order, polynomials of a common parameter, t, that should suffice for the conditions you describe.

댓글을 달려면 로그인하십시오.

답변 (1개)

Torsten
Torsten 2017년 12월 5일
A polynomial cannot have an infinite slope.
Best wishes
Torsten.
  댓글 수: 5
João
João 2017년 12월 5일
The goal is that the polynomial will be tangent at y2.
Torsten
Torsten 2017년 12월 5일
You can't find a polynomial that is tangent to x=x2.
Of yourse, you can try to make the slope arbitrary large by setting a2 to a large number, but I doubt that the polynomial will look fine over the interval.
Best wishes
Torsten.

댓글을 달려면 로그인하십시오.

카테고리

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