Create a linear graph with using some values
1 次查看(过去 30 天)
显示 更早的评论
Hi everybody
I have a matrix, for ex a=[10 11 15 22 9 14] I want to create a linear graph using a's 2. and 5. values. Namely, peak points of new graph must be 11 and 9 and it must contain the same number of elements of "a" matrix.
How can i solve this problem?
1 个评论
采纳的回答
KSSV
2016-10-27
a=[10 11 15 22 9 14] ;
b = zeros(size(a)) ;
b(2) = a(2) ;
b(5) = a(5) ;
%%replace zeros of b with numbers less then 9 randomly
for i = 1:length(b)
if b(i)==0
b(i) = randi([1 9],1) ;
end
end
plot(b,'b')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!