Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Matlab Plotting Error Problem

1 visualización (últimos 30 días)
John
John el 6 de Abr. de 2014
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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.

Respuestas (2)

Youssef  Khmou
Youssef Khmou el 6 de Abr. de 2014
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 el 6 de Abr. de 2014
Editada: Image Analyst el 6 de Abr. de 2014
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;

La pregunta está cerrada.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by