Show only two y values in a plot
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello all,
Any possible way to show only two value (0.02 and 0.04) for the y-axis, because the other values are just noise.
This is what I use for now to plot:
figure()
plot(time,wavelength,'b-x', 'LineWidth',2)
grid
axis tight
xlabel('Time')
ylabel('Wavelength')
hold on
Thank you!![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1216942/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1216942/image.jpeg)
9 commentaires
Réponses (1)
KSSV
le 2 Déc 2022
tol = 10^-3 ; % fix your tolerance
idx = abs(wavelength-0.02)<=tol | abs(wavelength-0.04)<=tol ;
plot(time(idx),wavelength(idx),'+r')
0 commentaires
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!