# How can name labels in the Graph (4)

1 visualizzazione (ultimi 30 giorni)
Ana Soph il 20 Gen 2020
Please i need help, i have a Graph with eight different Years, and i want to know what year is the most near to the curve of LONG-TERM, so i have to name every curve in the graph that are named "Short-Term", but i don't know why because are from differente years.
If you have any idea, you can help me so much
This is the code
clear;clc;
Cyears = 8;
Cdays = 30; % Abril
RAD = nan(Cdays, Cyears); % Average daily data: dia x año
for i=1:Cyears % cada año es una pestaña en la hoja de calculo
RS = xlsread('RAB',i); % archivo local a la carpeta
end
% RAS: check (siempre chequear que las cosas intermedias tienen sentido)
xcdf = (floor(min(RAD(:))):.5:ceil(max(RAD(:))))'; % vector fijo para todas las CDFs de temperatura
Ccdf = length(xcdf);
% CDF LONG-TERM
CDFmed_lt = zeros(Ccdf, 1);
N_lt = length(RMED_TS);
for k=(1:N_lt)
CDFmed_lt = CDFmed_lt + (xcdf>=RMED_TS(k));
end
CDFmed_lt = CDFmed_lt/N_lt;
figure(2)
plot(xcdf, CDFmed_lt, '.-g'); hold on;
title('CDFs de Largo Plazo');
ylabel('CDF');
% CDF SHORT-TERM
CDFmed_st = zeros(Ccdf, Cyears);
for n=(1:Cyears)
for m=(1:Cdays)
end
end
CDFmed_st = CDFmed_st/Cdays;
figure(3)
plot(xcdf, CDFmed_lt, '*-b'); hold on; % Pongo el plot azul aca solo para que se vea bien el legend
for n=(1:Cyears)
plot(xcdf, CDFmed_st(:,n), '.-r');
end
plot(xcdf, CDFmed_lt, '*-b'); hold off;
legend('Largo Plazo', 'Corto Plazo');
ylabel('CDF');
FS=zeros(1, Cyears);
for k=(1:Cyears)
FS(k)=sum(abs(CDFmed_st(:,k)-CDFmed_lt))/Ccdf;
end
FS =FS';
figure(4)
MSKmin = (FS == min(FS));
plot(xcdf, CDFmed_lt, '.-b'); hold on;
plot(xcdf, CDFmed_st(:, MSKmin), '.-g');
for n=(1:Cyears)
plot(xcdf, CDFmed_st(:,n), '.-r');
end
plot(xcdf, CDFmed_st(:, MSKmin), '.-g');
hold off;
title('CDFs de Largo Plazo');
legend('CDF Largo Plazo', 'CDF Menor FS', 'CDFs Corto Plazo')
ylabel('CDF');
** i need to name in the graph four every curve with the years i have, note: the years are not consecutive, i have some loops, because I don't have data from those years
Thank you so much!
Best!!!
ANA S:
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by