Re: need color help
- From: "Stefan " <jo@xxxxxxxxx>
- Date: Fri, 1 Aug 2008 07:49:02 +0000 (UTC)
"Simon Walter" <saberhagen12@xxxxxxxx> wrote in message
<g6q6ba$9c1$1@xxxxxxxxxxxxxxxxxx>...
Thank you all for ur inputs!blue...).
Looks like there is a need for further explanation...
I have a signal from an accelerator that is several thousand
elements long, each element between -2 and 2. I did write an
algorithm to classify four different postures (walking,
sitting, lying and standing).
Of course, every posture lasts at least several seconds
(sampling frequency is 100per s). I can detect those
intervals of constant signal character.
Now, what I want is an instrument to check if the algorithm
did identify those postures correctly. The best way to do
that is visually because in the original signal the posture
is easy to detect (visually, if you know how it looks).
For this reason I created a vector of the same length as the
signal. Next I assigned a number to every posture (i.e.
walking =1, sitting =2...).
Now, I want to plot this vector with the original signal
where I can compare them. My idea was to get a line and each
posture gets a color (e.g. walking -> red, sitting ->
Like that I can see which area of the signal belongs to
which posture and check if it is correct.
I hope I could make that clear:-)
So, I have this vector with 4 different numbers, each number
comes in intervals of several hundred. And each number can
appear more than once.
I don't want to emphasize the individual point, I am
interested in the line (which I plan to make wide, LineWidth
=15 or something). As there are so many points, it does not
really matter at which point exactly the color changes (the
last of the last number or at the first of the next). Well,
to me it is not important, I can't see it anyway. To make it
clear it can change at the beginning of the next number
(just what is easiest).
Sorry for this long explanation, this is what I wanted to
prevent in the first place but sometimes simplifications
don't make it easier.
I hope you understand what I really want and even more that
you can help me!
thx for patience
Hi,
As far as I understood, you have got a data plot and you
need a second plot showing the classification values of the
data plot.
Plotting one line in differnt color is not that easy, but
you could use a surface plot to visualize your classes.
% Define the data array.
data = [0.1 0.3 0.2 0.4 0.6 0.9 0.6 1.3 1.2 1.3 1.6 1.7 1.8];
% Assign a class to each data value.
classes = [1 1 1 2 2 2 3 3 3 4 4 4];
% Create the xy-meshgrid of the surface plot.
classXY = repmat([0;2], size(classes));
% Extend the xy grid by one column for proper display.
classXY = horzcat(classXY, [0;2]);
% Create the surface plot color matrix
classColors = vertcat(classes, classes);
% Plot the data
figure
subplot(2,1,1)
surface(classXY, classColors, 'Edgecolor', 'none');
axis tight
subplot(2,1,2)
plot(data)
axis tight
Maybe this comes near to what you intend to do.
You also might overlay the data and surface plot for better
visualization.
Until later,
Stefan.
.
- Follow-Ups:
- Re: need color help
- From: Simon Walter
- Re: need color help
- Prev by Date: interp2 alternative??
- Next by Date: Re: linear equation with restrictions
- Previous by thread: interp2 alternative??
- Next by thread: Re: need color help
- Index(es):
Relevant Pages
|
Loading