How to implement Hermite spline in Simulink

5 Ansichten (letzte 30 Tage)
MARCO LORENZI
MARCO LORENZI am 22 Sep. 2021
Bearbeitet: MARCO LORENZI am 24 Sep. 2021
Good morning everyone.
Can i ask if it there is a way to implement the Hermite spline (pchip) or Bezier curves in simulink?
In particular, i am using a look-up table to interpolate a curve between some point, but the cubic and akima splines don't do a good job. I was thinking about using a linear interpolating method and then smoothen up the curves, but i can't find any blockset.
Thank you very much in advance.

Akzeptierte Antwort

Bjorn Gustavsson
Bjorn Gustavsson am 22 Sep. 2021
There is a way to make blocks that wrap a matlab-function (matlab-functions-simulink_5), shouldn't that solve this task?
HTH
  5 Kommentare
MARCO LORENZI
MARCO LORENZI am 24 Sep. 2021
i don't think it is hard but i do not know how to do it. Basically, based on the input, that goes from 0 to 90, the first block does this:
The second one this:
And the output is y.
Bjorn Gustavsson
Bjorn Gustavsson am 24 Sep. 2021
To me it seems as you swapped the x and xq in the function. It ought to be:
function output = low_angles_Hermite_approximation(phase)
xq = phase;
y = [0 0 0 0 0 0 0 1 1];
x = [0 2.5 5 7.5 10 13 15 30 90];
output = pchip(x,y,xq);
When you program and run into errors like these read the help and documentation carefully - and calmly, far to often it is easy to rush that part. Also be prepared to use the debug-facilities of matlab, I typically turn on debug-stop after an error:
>> dbstop if error
Then you get a command-line prompt at the line where the error occurred with command-line access to all variables in the function and it is possible to step up in the function call-stack.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by