필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Matlab Plotting Error Problem

조회 수: 1 (최근 30일)
John
John 2014년 4월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi everyone, I have encountered an error in plotting graph. It says Data must be a single matrix Y or a list of pairs X,Y.
The following is my code. Hour = linspace(1,24,24);
Clementi_Primary_School = [31109 30599 30599 30599 30599 45899 66298 137697 152996 143817 150446 147896 150956 155546 156056 151976 139227 112197 85678 61199 55079 50999 45899 41309];
Clementi_Primary_School_24Hrs = [2204675];
plot(Hour,Clementi_Primary_School,Clementi_Primary_School_24Hrs);
Please advise me on what I can do to solve this problem.

답변 (2개)

Youssef  Khmou
Youssef Khmou 2014년 4월 6일
Graph of one dimensional function is made with vectors X,Y with the same length,
add this to your program :
Clementi_Primary_School_24Hrs = [2204675]*ones(size(Clementi_Primary_School));

Image Analyst
Image Analyst 2014년 4월 6일
편집: Image Analyst 2014년 4월 6일
Try this:
Hour = linspace(1,24,24);
Clementi_Primary_School = [31109 30599 30599 30599 30599 45899 66298 137697 152996 143817 150446 147896 150956 155546 156056 151976 139227 112197 85678 61199 55079 50999 45899 41309];
Clementi_Primary_School_24Hrs = repmat(2204675, 1, length(Hour));
plot(Hour,Clementi_Primary_School,Hour,Clementi_Primary_School_24Hrs, 'LineWidth', 3);
grid on;

이 질문은 마감되었습니다.

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by