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
Welcome Matrixmania Blog
-> Sitemap / Search <-
-> Books <-
Forums and Help
Contact
Basics Quick Matlab Guide
Matlab Tutorial
Matlab Examples
Matlab Flow Control
Boolean Logic
Plots and GUI Matlab 2D Plots
Matlab 3D Plots
Matlab GUI
Applications Calculus
Linear Algebra
Matlab Cookbook I
Matlab Cookbook II
Electrical Calculations
Probability and Stats
Finance Apps
Other Relevant Links
Notes on Computing
Online Calculators
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'
 
Top

Discrete plots: stems

Another way of 2D simple animation

3D animation

 

footer for comet plot page