필터 지우기
필터 지우기

how to plot like this

조회 수: 1 (최근 30일)
Afsher P A
Afsher P A 2020년 7월 27일
댓글: Afsher P A 2020년 7월 27일
Sample data
April19 [ 1 2 3....30 31] % days
Kwh = [ 40 43 44...40 41]
May19 [ 1 2 3....30 31] % days
Kwh = [ 39 43 42...41 42]
.
.
.
March20 [ 1 2 3....30 31] % days
Kwh = [ 50 49 40...45 44]
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 7월 27일
Have you already read in the data? Into a cell array?
Afsher P A
Afsher P A 2020년 7월 27일
My data attached with excel file

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

채택된 답변

Image Analyst
Image Analyst 2020년 7월 27일
Try this:
data = readmatrix('data.xlsx')
months = {'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'};
[rows, columns] = size(data)
for k = 1 : 2 : columns
plot(data(:, k), data(:, k+1), '.-', 'LineWidth', 2, 'MarkerSize', 20);
hold on;
end
fontSize = 18;
xlabel('Day', 'FontSize', fontSize);
ylabel('kWh', 'FontSize', fontSize);
grid on;
legend(months);
  댓글 수: 1
Afsher P A
Afsher P A 2020년 7월 27일
clear; close all; clc
data = readmatrix('data.xlsx')
months = {'April19', 'May19', 'Jun19', 'Jul19', 'Aug19', 'Sept19', 'Oct19', 'Nov19', 'Dec19', 'Jan20', 'Feb20', 'Mar20'}
[rows, columns] = size(data)
for k = 1 : 2 : columns
plot(data(:, k), data(:, k+1), '.-', 'LineWidth', 2, 'MarkerSize', 20);
hold on;
end
fontSize = 18;
xlabel('Day', 'FontSize', fontSize);
ylabel('kWh', 'FontSize', fontSize);
grid on;
legend(months);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by