needed some help with this ERROR function
古いコメントを表示
function fireworks %% global AxesSize ; AxesSize = 70000 ; figure('MenuBar','none', 'ToolBar','none'); Handle = gcf ; while 1 Num = 100 ; Radio = 0:360/Num:360 ; V = rand(1,Num+1)*3000 ;
%
RandX = rand ;
if RandX<0.5
RandX = -RandX ;
end
Lx0 = RandX*50000;
RandY = rand ;
if RandY<0.5
RandY = -RandY ;
end
Ly0 = RandY*50000;
test_fashe(Handle, Lx0, Ly0) ;
%
test_press(Lx0, Ly0, Radio, V, Handle) ;
if ~ishandle(Handle)
break ;
end
end
% ------------------------------------ function test_fashe(Handle, Lx0, Ly0) %%
Num = 20 ; XStep = (Lx0+0) / Num ; YStep = (Ly0+50000) / Num ;
% start position XData = 0 ; YData = -50000 ;
global AxesSize ; LineHandle=plot([XData,Lx0],[YData,Ly0],'b-','LineWidth',3, 'Visible', 'off') ; set(gca,'XLim',[-AxesSize,AxesSize],'YLim',[-AxesSize,AxesSize],... 'color',[0 1 1],'XTick',[],'YTick',[]) ;
for i = 0 : Num-1
BeforeXData = XData ;
BeforeYData = YData ;
XData = BeforeXData+XStep;
YData = BeforeYData+YStep;
if ~ishandle(Handle)
return ;
end
set(LineHandle, 'XData', [BeforeXData,XData], ...
'YData', [BeforeYData,YData], 'Visible', 'on' ) ;
set(gca,'XLim',[-AxesSize,AxesSize],'YLim',[-AxesSize,AxesSize],...
'color',[0 1 1],'XTick',[],'YTick',[]) ;
pause(0.03) ;
drawnow ;
end
% ------------------------------------ function test_press(Lx0, Ly0, Radio, V, Handle) %%
g = 10 ; t = 0:0.2:40 ; Detal = 3.1415926/180 ; Ttime = length(t) ;
global AxesSize ;
% Vx = V.*sin(Detal.*Radio) ; Vy = V.*cos(Detal.*Radio) ;
ColorStr = {'r','g','b','k','y'} ;
RandValue = randperm(5) ; CurColor = ColorStr{RandValue} ; for i = 1:Ttime Vx = (Ttime-1)*Vx/Ttime ; Vy = (Ttime-1)*Vy/Ttime ;
Lx = Lx0 + Vx.*t(i) ;
Ly = Ly0 + Vy.*t(i) - 0.5*g*t(i)^2 ;
if ~ishandle(Handle)
return ;
end
plot( Lx, Ly, 'o',...
'MarkerEdgeColor',CurColor,...
'MarkerFaceColor',CurColor,...
'MarkerSize',10) ;
set(gca,'XLim',[-AxesSize,AxesSize],'YLim',[-AxesSize,AxesSize],...
'color',[0 1 1],'XTick',[],'YTick',[]) ;
drawnow ;
end
% MarkerSize = 10 ; Ttime = 200 ; for i = 1 : Ttime MarkerSize = MarkerSize - 0.05 ; if MarkerSize <= 0 MarkerSize = 0.01 ; end Ly = Ly - 100 ;
if ~ishandle(Handle)
return ;
end
plot( Lx, Ly, 'o',...
'MarkerEdgeColor',CurColor,...
'MarkerFaceColor',CurColor,...
'MarkerSize',MarkerSize) ;
set(gca,'XLim',[-AxesSize,AxesSize],'YLim',[-AxesSize,AxesSize],...
'color',[0 1 1],'XTick',[],'YTick',[]) ;
drawnow ;
end
1 件のコメント
John D'Errico
2015 年 12 月 2 日
So, what is the problem? Explain your problem.
Else we must we read through your code line by line, figuring out first what it is you need to do from the code, then try to figure out what is your problem. That could easily take nearly as long as it took you to write the above code.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Spline Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!