Re: need color help



"Simon Walter" <saberhagen12@xxxxxxxx> wrote in message
<g6q6ba$9c1$1@xxxxxxxxxxxxxxxxxx>...
Thank you all for ur inputs!

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 ->
blue...).
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.





.



Relevant Pages

  • Re: need color help
    ... algorithm to classify four different postures (walking, ... sitting, lying and standing). ... every posture lasts at least several seconds ... I want to plot this vector with the original signal ...
    (comp.soft-sys.matlab)
  • Re: conv
    ... You would have got an answer if ppl did not have to read all the way .. ... you could write the conv routine yourself using first principles to plot the intermediate results at each step. ... If its the result you want to visualize, please type the following at the MATLAB prompt: ... convolution between two graph. ...
    (comp.soft-sys.matlab)
  • Re: How to plot a 3D+value array
    ... I need to visualize this function somehow, but I fail to see how i ... So how can i plot this function in matlab? ...
    (comp.soft-sys.matlab)
  • Re: plot on top of surf
    ... Have you tried using plot3 to give the dots you want to plot some ... If your surface plot has positive z values, ... > (I want to plot a land/sea mask on a surface map. ... > latitude/longitude grid as matrixes ). ...
    (comp.soft-sys.matlab)
  • Re: Surface plots in MATLAB R2006b
    ... I am trying to create a surface plot for ... When I try and form the plot Matlab just stops working and becomes ... to stop working when the number on point on the x axes times the ...
    (comp.soft-sys.matlab)

Loading