![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177531/image.png)
plotting 2 x points per y?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
If i had an array of two x points like
{x} = [-1.9 2], [-1.8, 1.8], [-1.5, 1.3]
how can i plot these points for lets say y = 0, 0.05, 0.1
so for example, for y = 0, i would have x = -1.9 and x = 2 plotted. so it will look like a triangular wave?
0 commentaires
Réponses (1)
Image Analyst
le 26 Juin 2015
Try this:
x = [-1.9 2; -1.8, 1.8; -1.5, 1.3]
y = [0, 0.05, 0.1]
plot(x(:,1), y, 'b*-', 'LineWidth', 2);
hold on;
grid on;
plot(x(:, 2), y, 'rd-', 'LineWidth', 2);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177531/image.png)
Look how each Y value occurs at two different X values.
0 commentaires
Voir également
Catégories
En savoir plus sur Line Plots 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!