logo for matrixlab-examples.com
[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Matrixmania Blog
Contact
-> Sitemap <-
Matlab Books
Quick Matlab Guide
Matlab Tutorials
Matlab Examples
Matlab Flow Control
Boolean Algebra
Linear Algebra
Matlab 2D Plots
Matlab 3D Plots
Matlab GUI
Matlab Cookbook I
Matlab Cookbook II
Probability and Stats
Forums and Help
Relevant Links
Fun!
Your own Website?
Terms/Policies
leftimage for matrixlab-examples.com

Comet Plot

comet(a) displays an animated comet plot of the vector a.
comet(a, b) displays an animated comet plot of vector b vs. a.
comet(a, b, p) uses a comet of length p*length(b).  Default is p = 0.10.

Example:



If you want to plot the following function:
comet plot 1, for the range comet plot 2,  you can write this script in Matlab:

% Clears variables, command window, and closes all figures
clc; clear; close all

% Generates 300 linearly spaced points from 0 to 8*pi
x = linspace(0, 8*pi, 300);

% Creates the formula to be plotted
% (it's a multiplication between vector 'x' and vector 'cos(x)')
y = x .* cos(x);

% Plot it!
comet(x, y, .6)



An the result is...

comet plot

It is much better to see it on your own screen, because it moves like a ribbon!

You can experiment with different p values to see the length of the comet changing...


From 'Comet Plot' to home
From 'Comet Plot' to 'Matlab Plots'

footer for comet plot page