To smooth the 3D track by using low pass or sgolay filter.

2 vues (au cours des 30 derniers jours)
Imtiaz Ahmad
Imtiaz Ahmad le 31 Mai 2020
Commenté : Ameer Hamza le 2 Juin 2020
Hi Everyone.
I have my vehicle model to move on the track. So, i have 3 data sets x,y ,z and by using these vectors i genrated a 3D track.I would like to smooth my path by using filters. I tried with low pass and sgolay filter but they are not working well or maybe i didn't use them correctly.Can anybody help to smooth the track.i have attached a matlab file.Thank you

Réponse acceptée

Ameer Hamza
Ameer Hamza le 1 Juin 2020
Try this
a = [0 9 10 9 8 7 6 4 2 -12 4 3 5 8 7 11 14 6 5 0 -4 -3 -15 -11 -9 -4 0];
b = [0 0 5 10 2 10 7 12 6 12 14 20 18 12 17 6 3 -20 -4 -20 -2 -20 -2 9 -1 0 0];
c = [0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 -15 -5 -10 0 15 2 10 -2 0 0];
t = linspace(0, 1, numel(a));
tq = linspace(0, 1, 10*numel(a));
x = pchip(t, a, tq);
y = pchip(t, b, tq);
z = pchip(t, c, tq);
plot3(a,b,c)
hold on
plot3(x,y,z)
grid on
xlabel('X(m)');
ylabel('Y(m)');
zlabel('Z(m)');
You can also try to replace pchip with spline() and makima()
  2 commentaires
Imtiaz Ahmad
Imtiaz Ahmad le 1 Juin 2020
Hello Mr. Ameer Hamza,
Thank you so much.It worked for me.
Ameer Hamza
Ameer Hamza le 2 Juin 2020
I am glad to be of help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by