Create a linear graph with using some values

조회 수: 1 (최근 30일)
Volkan Yangin
Volkan Yangin 2016년 10월 26일
답변: KSSV 2016년 10월 27일
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
Robert
Robert 2016년 10월 26일
편집: Robert 2016년 10월 26일
More information please so we can assist. What exactly are you trying to do? Are you trying to plot 2 and 5 against each element in the matrix? I don't understand what your trying to do

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
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개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by