Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab形状对象if函数_Matlab_Graph_Shape_Polygons - Fatal编程技术网

matlab形状对象if函数

matlab形状对象if函数,matlab,graph,shape,polygons,Matlab,Graph,Shape,Polygons,我想在matlab中移动一个对象。我的代码具有以下性质 global stop stop = 0; for frame=1:1:length(t) if stop ~= 1 axes(handles.aaxes) cla hold on if y(frame)<=0 rectangle('Position',[3,1,3,(0.000001)],'FaceColor','b'); else rectangle('Pos

我想在matlab中移动一个对象。我的代码具有以下性质

global stop
stop = 0;
 for frame=1:1:length(t)
    if stop ~= 1
    axes(handles.aaxes)
    cla
    hold on

    if y(frame)<=0
      rectangle('Position',[3,1,3,(0.000001)],'FaceColor','b');
    else
    rectangle('Position',[3,1,3,((y(frame)+0.00000001))],'FaceColor','b');
    end
   hold off 
    axes(handles.graph)
    cla
    hold on
    plot(t,y)
    plot(t(frame),y(frame),'*k')

    end
%     FF(f)=getframe;
%     f=f+1;
end

这使我的矩形不断向上移动,直到它固定到图形用户界面的某个高度位置y。然而,我希望我的矩形向下移动,而不是向上移动,从而固定到某个位置y。有可能吗

你的例子不起作用。请提供一个a。矩形向上并固定到最终高度y。我如何使它振荡得更少?如果没有看到所有的代码,我会假设路由设置为y和t。解决方法是调整y和t以获得所需的运动。如果你没有时间控制你的帧,可以帮助控制速度。