plotting graph and mark points

Hi, I have a set A that contain 200 points and a subset of the set B.I need to graph the A and I need to mark the points in the set B in A.I can't mark those points correctly.Please help me.

3 Comments

Well, think you'll have to tell us more than that..what did you actually do (show the code) and what isn't what you expected and what would you expect instead?
Attaching sample data and figure showing what it is that isn't what you wanted would always help...
Answer moved to Comment...dpb
I use a ucr time series data set.I extract some points based on a condition.The extracted points I need to mark in the original set.I use the plot function.
I don't know what "ucr" means, not do you say a thing useful to help us know what, specifically you have done nor what "a condition" is...POST CODE and DATA, not just words....

Sign in to comment.

 Accepted Answer

d = xlsread('FaceFour_TRAIN.xlsx');
plot(d);
hold on
idx = find(d>0.04);
pointsize = 20;
scatter(idx, d(idx), pointsize, 'b', '*')
hold off

15 Comments

dpb
dpb on 16 Sep 2019
Edited: dpb on 16 Sep 2019
OP Answer moved to Comment--dpb:
If I use
b=zeros(24,1);
d = xlsread('FaceFour_TRAIN.xlsx')
s=d(1:1,2:end)
plot(s)
hold on
for i=1:24
b(i,:)=i;
c=d(b==i,:)
fa=movstd(c,20,1)
secarray=movstd(fa,20,1)
f=secarray(secarray>.04);
end
disp f
pointsize = 50;
scatter(f, s(f), pointsize, 'r', '.')
hold off
then how can i point f in s .Please help me
b(i,:)=i;
c=d(b==i,:)
fa=movstd(c,20,1)
Why are you doing that? Why are you not just doing
fa = movstd(d(i,:),20,1);
I need to find moving standard deviation two times.It is a time series dataset ,then how can I find all the movstd of each row and the max points and I need to mark the max points after the second movstd into the time series.Please help me.Thank you
Do you see some circumstances under which the output of
b(i,:)=i;
c=d(b==i,:)
fa=movstd(c,20,1)
would be different than the output of
fa = movstd(d(i,:),20,1);
?
That is, do you see some circumstances under which
b(i,:)=i;
c=d(b==i,:)
would end up with a c that is differnet than d(i,:) ?
But I can't get the result of next steps.If I have
a=[-1,3,4,6,8,-7,-01,-09,-2,5,10]
max=maxk(a,5)
plot(a)
Then how will I get a graph that marked with max.
a = [-1,3,4,6,8,-7,-01,-09,-2,5,10]
[maxvals, maxidx] = maxk(a,5);
x = 1 : length(a);
plot(x, a, 'b-', maxidx, a(maxidx), 'go')
This plots a as a line in blue, and also circles the 5 maxima in green.
Thank you very much sir.
I have another doubt if the code is like this
s=d(1:1,2:end)
fa=movstd(s,20,1)
secarray=movstd(fa,20,1)
f=secarray(secarray>.04);
max=maxk(f,10)
then how mark the max in s.(d is dataset)
s = d(1:1,2:end);
fa = movstd(s,20,1);
secarray = movstd(fa,20,1) ;
secidx = find(secarray>.04);
f = secarray(secidx);
[maxvals, maxidx] = maxk(f,10);
sidx = secidx(maxidx);
x = 1:length(s);
plot(x, s, 'b-', sidx, s(idx), 'go', sidx, maxvals, 'k*')
This plots a line for the original s. On that line, it will circle the points that turned out to have the maximum f value in green. This code also will plot the location and values of those maximum f as black asterisks.
If it possible to mark only the max in s(using only the plot of s),without other things.
s = d(1:1,2:end);
fa = movstd(s,20,1);
secarray = movstd(fa,20,1) ;
secidx = find(secarray>.04);
f = secarray(secidx);
[maxvals, maxidx] = maxk(f,10);
sidx = secidx(maxidx);
then
plot(sidx, s(idx), 'go')
Though possibly you would instead prefer
hold on
for idx = 1 : length(maxidx)
xline(maxidx(idx),'g');
end
hold off
sir,using this getting errors.I need to mark the max points only in s.The max points are from secarray that contain 14 points.
plot(sidx, s(sidx), 'go')
I need to plot the s.In the graph of s the max need to mark.The max is from the secidx
s = d(1:1,2:end);
fa = movstd(s,20,1);
secarray = movstd(fa,20,1) ;
secidx = find(secarray>.04);
s = d(1:1,2:end);
fa = movstd(s,20,1);
secarray = movstd(fa,20,1) ;
secidx = find(secarray>.04);
f = secarray(secidx);
[maxvals, maxidx] = maxk(f,10);
sidx = secidx(maxidx);
x = 1:length(s);
plot(x, s, 'b-', sidx, s(sidx), 'go')
thank you very much sir.

Sign in to comment.

More Answers (2)

d = xlsread('FaceFour_TRAIN.xlsx')
f=d(d>.04);
plot(d)
I need to mark the f in d and the d I need to represent like a single plot.How it possible please help me.
s = d(1:1,2:end);
fa = movstd(s,20,1);
secarray = movstd(fa,20,1) ;
secidx = find(secarray>.04);
f = secarray(secidx);
[maxvals, maxidx] = maxk(f,10);
sidx = secidx(maxidx);
x = 1:length(s);
plot(x, s, 'b-', sidx, s(sidx), 'go')

1 Comment

This does not appear to be an answer to the user's question?

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!