Mode identification on a Graph.

Hello everyone,
I am a beginner with MATLAB and i need some assistance. I need to produce a graph similar to this one attached. I want to include the vertical dotted lines and the labelling on the graph (HF, IF, AND Trend). My question is how to I do this, I only know that this will need some threshold.
Thanks.

3 comentarios

Clayton Gotberg
Clayton Gotberg el 24 de Abr. de 2021
Can you include any code you already have for making a chart like this? Additionally, do you need to be able to generate the dotted lines and region labels as part of the program (do you need to analyze the points to find the regions?) or do you already know where the dotted lines and regions should be?
In the meantime, take a look at the text function and the labelpoints package in the File Exchange. Also, note that you can plot dashed lines with plot(x,y,'--').
mpho bosupeng
mpho bosupeng el 24 de Abr. de 2021
Editada: mpho bosupeng el 24 de Abr. de 2021
Thanks @Clayton Gotberg. The code is
plot(time,signal)
xlabel('year')
ylabel('PIL')
IMFH=IMF_R(1:end,2*L+1:end-2*L);
NumIMFH=size(IMFH,1);
sumIMFH=0;
for j=1:NumIMFH
sumIMFH=IMFH(j,:)+sumIMFH;
STH(j)=nanmean(sumIMFH)/std(sumIMFH);
indiH(j)=j;
end
figure
plot(indiH(1:end-1),STH(1:end-1),'ok')
ylabel('\mu/\sigma')
xlabel('c_j')
I need to analyze the points to find the regions
Adam Danz
Adam Danz el 24 de Abr. de 2021
You can also add the vertical lines using xline()
> I need to analyze the points to find the regions
Ok, let us know exactly what you need help with.

Iniciar sesión para comentar.

 Respuesta aceptada

Clayton Gotberg
Clayton Gotberg el 24 de Abr. de 2021
It looks like you already have the code to find out where the divisions should be. In that case, all that remains to be solved is:
  1. The plot is missing the vertical lines to separate the regions
  2. The plot doesn't have the region labels
HF_IF_divider = ; % this value should be the point in x at which the HF and IF regions touch
IF_Trend_divider = ; % this value should be the point in x where IF and Trend meet
plot(data) % replace with all of the plotting you've done so far
hold on
% Add the vertical lines
xline(HF_IF_divider,'k--') % Thanks @Adam Danz for mentioning this great function
xline(IF_Trend_divider,'k--') % 'k' means black lines, '--' means dashed lines
label_x = [1/2*HF_IF_divider, 1/2*(IF_Trend_divider+HF_IF_divider),...
1/2*(length(signal)+IF_Trend_divider)]; % x positions of labels
label_y = [0.5 0.5 0.5]; % Change this to modify the height of the label
zone_names = ["HF" "IF" "Trend"];
text(label_x,label_y,zone_names,'HorizontalAlignment','center','VerticalAlignment','middle','FontSize',12);

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Abr. de 2021

Respondida:

el 24 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by