简体   繁体   中英

matlab - graph plotting

i have two arrays to plot, array a[1,5] in x axis and array b[4,5] in y axis. i used plot(a,b), The problem is that the elements of array a are not ordered so when the graph is drawn it connect between points in the same order of the array elements so the graph line once go right and anothor left and so, also i want it to be in a curve shape??

Sort a and plot b using the indices of the sorted version of a :

[asorted ind] = sort(a);
 plot(asorted,b(:,ind));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM