Learn Basic Plotting Principles

by

 

18 Oct 2009 (Updated )

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

slide25
function slide25
	
	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]);
	
	X = -4:.01:4;
	Y = sin(1*X);
	p = plot(X,Y);
	set(p,'linewidth',2,...
		'color',[0,0,0])

	s1 = uicontrol('style','slider',...
		'units','normalized',...
		'position',[.1 .1 .2 .1],...
		'min',0,...
		'max',10,...
		'value',1,...
		'callback',@changes);
	
	function changes(varargin)
		cla          
		
		w = get(s1,'value');
		Y = sin(w*X);
		
		p = plot(X,Y);
		set(p,'linewidth',2,...
			'color',[0,0,0])
		
	end
	
	
end

Contact us