animationExamples

# animationExamples - % Simple Plotting x = [5 10 15]; y =...

This preview shows pages 1–2. Sign up to view the full content.

%% Simple Plotting x = [5 10 15]; y = [20 21 22]; plot(x,y) % plot(time,acceleration) % axis([minOfX maxOfX minOfY maxOfY]) axis([min(x)-1 max(x)+1 min(y)-1 max(y)+1]) %% Example from LEC06 - no trail x = 0:0.1:10; y = 5*x.^2 - 3*x; for k=1:length(x) plot(x(k),y(k),'X') axis([min(x) max(x) min(y) max(y)]) pause(0.1); end %% Example from LEC06 - trail only x = 0:0.1:10; y = 5*x.^2 - 3*x; for k=1:length(x) plot(x(1:k),y(1:k),'X') axis([min(x) max(x) min(y) max(y)]) pause(0.01); end %% Example from LEC06 - no trail % X floating through space for t=0:0.1:20 % choose a small interval x=t*cos(t); y=5*sin(t); pause(0.05) % can come anywhere in the loop plot(x,y,'X') axis([-20 20 -5 5]) % must follow plot end %% Example from LEC06 - no trail % X floating through space t = 0:0.1:20; x=t.*cos(t); % don?t forget dot operations y=5*sin(t); for k = 1:length(x) pause(0.05) % can come anywhere in the loop plot(x(k),y(k),'X') axis([min(x) max(x) min(y) max(y)]) end %% Example from LEC06 - point and trail % X floating through space, leaving a trail t = 0:0.1:20; x=t.*cos(t); % don?t forget dot operations

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## animationExamples - % Simple Plotting x = [5 10 15]; y =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online