How can name labels in the Graph (4)

1 view (last 30 days)
Ana Soph
Ana Soph on 20 Jan 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
% PARA RADIACIÓN SOLO SE USA EL ACUMULADO DIARIO
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
RAD(:, i) = 600*sum(RS)'/1000000;
end
% RAS: check (siempre chequear que las cosas intermedias tienen sentido)
figure(1); imagesc(RAD); colorbar;
%Vectores para CDF radiación
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);
RMED_TS = RAD(:);
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');
legend('Radiación Abril')
xlabel('Radiación Global Diaria (MJ/m^2)');
ylabel('CDF');
% CDF SHORT-TERM
CDFmed_st = zeros(Ccdf, Cyears);
for n=(1:Cyears)
for m=(1:Cdays)
CDFmed_st(:,n) = CDFmed_st(:,n) + (xcdf>=RAD(m,n));
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;
title('CDFs Radiación Abril');
legend('Largo Plazo', 'Corto Plazo');
xlabel('Radiación Global(MJ/m^2)');
ylabel('CDF');
%Estadistico FS
FS=zeros(1, Cyears);
for k=(1:Cyears)
FS(k)=sum(abs(CDFmed_st(:,k)-CDFmed_lt))/Ccdf;
end
FS =FS';
xlswrite('FSRadiacionAbril.xlsx', FS, 'Hoja1', 'A1');
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')
xlabel('Radiacion (MJ/m^2)');
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:

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!