discrete line plot in matlab 2015?
    6 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
A =[1	0.122	0.05	0.093	0.113
6	0.18	0.071	0.135	0.168
10	
15	0.252	0.103	0.138	0.158
22	0.354	0.124	0.136	0.184
40	0.456	0.542	0.752	0.33
60	0.371	0.164	0.268	0.239
100	0.403	0.164	0.341	0.437
135	0.711	0.443	0.552	0.665
]
figure('Color','w')
plot(A(:,1),A(:,2:5))
How to plot this discrete line plot? 10 doesn't have any data.
0 commentaires
Réponse acceptée
  KSSV
      
      
 le 10 Juin 2021
        
      Modifié(e) : KSSV
      
      
 le 10 Juin 2021
  
      Replace those values with NaN and plot:
A =[1	0.122	0.05	0.093	0.113
6	0.18	0.071	0.135	0.168
10	NaN     NaN     NaN     NaN
15	0.252	0.103	0.138	0.158
22	0.354	0.124	0.136	0.184
40	0.456	0.542	0.752	0.33
60	0.371	0.164	0.268	0.239
100	0.403	0.164	0.341	0.437
135	0.711	0.443	0.552	0.665] ; 
figure('Color','w')
plot(A(:,1),A(:,2:5))
Or fill the missing values using interpolation and plot. 
A =[1	0.122	0.05	0.093	0.113
6	0.18	0.071	0.135	0.168
10	NaN     NaN     NaN     NaN
15	0.252	0.103	0.138	0.158
22	0.354	0.124	0.136	0.184
40	0.456	0.542	0.752	0.33
60	0.371	0.164	0.268	0.239
100	0.403	0.164	0.341	0.437
135	0.711	0.443	0.552	0.665] ; 
% use interpolation to fill the data 
for i = 2:5
    idx = isnan(A(:,i)) ; 
    A(idx,i) = interp1(A(~idx,1),A(~idx,i),A(idx,1)) ; 
end
figure('Color','w')
plot(A(:,1),A(:,2:5))
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Annotations dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



