Effacer les filtres
Effacer les filtres

two plots are linked by an unwanted line - animated line

1 vue (au cours des 30 derniers jours)
Ross Hanna
Ross Hanna le 20 Jan 2019
Hi all
I am using animatedline to create an animation of a camshaft rotating and moving the bucket which sits on the valve.
I have created what i thought were two separate plots, one of the polar coordinates of the valve lift profile, and a horizontal line which is based on the minimum value of the camshaft in the Y direction. However, I have plotted these two and the animation works well apart from there being a line which connects the last point of the cam lobe to the horizontal line and I'm trying to get rid of it.
Below is a picture explaining what i mean;
clear
clc
load('Raw_Cam_Data')
theta = deg2rad(1:1:360)
phi = theta'
R = Lift' + 17.6
%==============================
h = animatedline;
axis([-30 30 -30 30])
rotation = (-pi:pi/180:pi - (pi/180))'
output = zeros(360,1)
for II = 1:1:length(phi)-1
x = R .* sin(theta + rotation(II))
y = R .* cos(theta + rotation(II))
[bucket, indice] = (min(y))
output(II) = indice
x_bucket = linspace(-25,25,359)
y_bucket = bucket * ones(359,1)
addpoints(h, x, y)
addpoints(h, x_bucket, y_bucket)
drawnow
clearpoints(h)
end
i have attached the .mat file of the cam lift profile, and my code is below. I'm sure I am missing something obvious but I might be too close to the woods to see the trees.
Thanks

Réponses (1)

Geoff Hayes
Geoff Hayes le 25 Jan 2019
Ross - have you tried creating two lines - one for the horizontal line and one for the cam lobe? By just using one animated line for both, the software is (probably) trying to join the two together so that there just exists one line.

Catégories

En savoir plus sur Animation dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by