Learn Basic Plotting Principles

by

 

18 Oct 2009 (Updated )

Powerpoint Slides on the fundamentals of plotting and using the function line() with animation.

slide47
function slide47
	
	figure('units','normalized',...
		'position',[0.1 .3 .5 .5],...
		'color',[ 1 1 1],...
		'menubar','none',...
		'name','Example',...
		'numbertitle','off');
	
	axes('units','normalized',...
		'position',[ .5 .4 .4 .5]);
	

	L1 = line([1 3],[3 4]);
	set(L1,'linewidth',2,...
		'color',[0,0,0])
	
	axis([-4 7 0 8])
	
	s1 = uicontrol('style','slider',...
		'units','normalized',...
		'position',[.1 .1 .2 .1],...
		'min',0,...
		'max',10,...
		'value',1,...
		'callback',@changes);
	
	tx1 = uicontrol('style','text',...
		'units','normalized',...
		'position',[.1 .6 .1 .05],...
		'string','0');
	
	function changes(varargin)
		
		p = get(s1,'value');
		
		set(L1,'xdata',[p p+2])
		
		set(tx1,'string',num2str(p))
		
	end
	
	
end

Contact us