how to comment on ploting data in graph?

조회 수: 13 (최근 30일)
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020년 10월 22일
편집: Image Analyst 2020년 10월 22일
Hi all;
i want to plot these two series of data and just nominate or comment two valuse from below series of data in ploting graph.
for example i want to give comment or name to 789 as required value in graph or 500 name as critical value.
solar radiation=[456 789 999 334 556 778 456 234 545 343 300 400 500 600 345]
heat gain=[456 789 765 345 234 654 768 979 567 456 678 453 867 989 234 ]
i will be very thankful .
thanks
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 10월 22일
The two vectors you have written have different lengths.
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020년 10월 22일
i editted my question dear .

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 22일
You can do something like this
solar_radiation=[456 789 999 334 556 778 456 234 545 343 300 400 500 600 345];
heat_gain=[456 789 765 345 234 654 768 979 567 456 678 453 867 989 234];
ax = axes();
hold on
p1 = plot(solar_radiation, heat_gain);
p2 = plot(500, heat_gain(solar_radiation==500), '.', 'MarkerSize', 50, 'DisplayName', 'Required Value');
p3 = plot(789, heat_gain(solar_radiation==789), '.', 'MarkerSize', 50, 'DisplayName', 'Critical Value');
legend([p2 p3])
  댓글 수: 2
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020년 10월 22일
thank you so much dear...
i want to import average of each day solar radiation from attached excel file but average of those solar radiation values which is greather than 200 for each day .
i will be very thankful dear.
thanks
Image Analyst
Image Analyst 2020년 10월 22일
편집: Image Analyst 2020년 10월 22일
Here it is again.
[numbers, strings, rawData] = xlsread('hiii.xlsx');
daysOfWeek = strings(2:end, 2);
% Threshold at 200
goodIndexes = numbers >= 200;
% Extract only those elements above 200.
numbers = numbers(goodIndexes);
daysOfWeek = daysOfWeek(goodIndexes);
% Label each individual day.
sequentialDays = ones(length(daysOfWeek), 1);
for k = 2 : length(sequentialDays)
if ~strcmpi(daysOfWeek{k}, daysOfWeek{k-1})
% It's not the same as the prior day so we're starting a new day.
sequentialDays(k:end) = sequentialDays(k-1) + 1;
end
end
% Get the averages over any and all hours of each day.
dailyAverages = splitapply(@mean, numbers, sequentialDays);
plot(dailyAverages, 'b-', 'LineWidth', 2);
title('Daily Average of Solar Radiation', 'FontSize', 18);
xlabel('Day', 'FontSize', 18);
ylabel('Average over the Day', 'FontSize', 18);
grid on;
% Smooth the daily averages
smoothedAverages = movmean(dailyAverages, 45);
hold on;
plot(smoothedAverages, 'r-', 'LineWidth', 4);
legend('Data >= 200', 'Smoothed');
g = gcf;
g.WindowState = 'maximized';
fprintf('Done running %s.m ...\n', mfilename);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geodesy and Mapping에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by