Azzera filtri
Azzera filtri

How to find u value at a point on cubic curve

1 visualizzazione (ultimi 30 giorni)
Mandar Parkhi
Mandar Parkhi il 12 Mar 2018
Risposto: Mandar Parkhi il 12 Mar 2018
I am trying to find equation of a hermetic cubic curve created by giving four points. I assume the parametric equation of the curve as x=a*u^3 + b*u^2 + c*u + d and y= e*u^3 + f*u^2 + g*u + h (where 0<=u<=1) and trying to find values of a,b,c,d,e,f,g,h. I assume u at any point on curve = (curve distance from start to the point) / (curve distance from start to end) But I am not getting correct equation satisfying all four points. Can someone suggest how to find u value at any point ?

Risposte (4)

John D'Errico
John D'Errico il 12 Mar 2018
So you have 4 points on a parametric curve, thus (x(u),y(u)), for 4 values of u?
Just use polyfit, getting a cubic for x(u), then use it again to get y(u). Read the help for polyfit if you don't know how to use it.
As far as what you are doing to NOT get the correct equation, how can we know what you did wrong, since you did not show us what you actually did?

Mandar Parkhi
Mandar Parkhi il 12 Mar 2018
Hi, thanks. I’ll try polyfit. I used A\b in Matlab to solve the 4 simultaneous equations. And I know my answers are wring, because I first defined a curve’s equation and plotted the curve. Then chose first, last and two intermediate points. Then by substituting the point coordinates in the equations, I found a b c d values. But they were not matching with my original equation. When I tried giving different u value, I got correct equation only when I did some trial error with u values of the 2nd and 3rd point. So I think if I can give correct u value, then I can get correct equation.

Mandar Parkhi
Mandar Parkhi il 12 Mar 2018
The rough sketch shows what I did. I created an equation driven curve in solidworks. Then chose 4 points and noted their coordinates. Then tried to derive equation of curve, which is not matching my original equation.

Mandar Parkhi
Mandar Parkhi il 12 Mar 2018
Concept

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by