two plots are linked by an unwanted line - animated line

1 回表示 (過去 30 日間)
Ross Hanna
Ross Hanna 2019 年 1 月 20 日
回答済み: Geoff Hayes 2019 年 1 月 25 日
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

回答 (1 件)

Geoff Hayes
Geoff Hayes 2019 年 1 月 25 日
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.

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by