How can I plot 2 vectors with different lenght and with a spacing of 3hours on the time axis?
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Ali Abdoul
 el 14 de Sept. de 2020
  
    
    
    
    
    Comentada: Ali Abdoul
 el 14 de Sept. de 2020
            Hi, 
i would like to plot a variation of field on 24hours with a 3hours spacing like 00  03  06  09...21  24
and i use linspace because my vectors have different length. when i plot, I get 0  5  10  ... 25 on the time axis with a 5hours spacing. 
here is my script
H0 = mean(H004(1:120)) + mean(H004(1321:1440));
H0 = H0/2;
dH004 = H004 - H0;
t = linspace(00,23,1440);
plot(t,dH004);    
xlabel('LT(hrs)');
ylabel('Variation field dH(nT)');
title('dH') 
2 comentarios
Respuesta aceptada
  BOB MATHEW SYJI
      
 el 14 de Sept. de 2020
        
      Editada: BOB MATHEW SYJI
      
 el 14 de Sept. de 2020
  
      Hope this helps. It has spacing of 3hrs from 0 to 24 hrs limit
%H0=[your matrix];
H0 = mean(H004(1:120)) + mean(H004(1321:1440));
H0 = H0/2;
dH004 = H004 - H0;
t = linspace(00,23,1440);    
AxesH = axes('Xlim', [0, 23], 'XTick', 0:3:23,'NextPlot','add');
plot(t,dH004);
xlim([0 23])
xlabel('LT(hrs)');
ylabel('Variation field dH(nT)');
title('dH')
Más respuestas (0)
Ver también
Categorías
				Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


